# Creating input from JSON Schema

In this article we'll quickly set up a ruleset by importing the input and entities from a JSON Schema file.

Let's first create a subscriber ruleset that calculates the subscriber's age and the subscription amount.&#x20;

1. Create a ruleset named `Subscriber`.
2. Create a constant named `SubscriptionCostPerDay` and set its value to `0.10`.

Now the ruleset needs input; we're going to take a shortcut and define the input through importing a JSON schema. This will result in automatic creation of Input and Entities. Entities are like objects, and you can create them by hand, but if you have a JSON schema, there is a much quicker and easier way:&#x20;

3. Download the `SubscriberSchema.json` file to your workstation.

{% file src="<https://content.gitbook.com/content/BDcAUVq7N2h9LMSsD3S3/blobs/XlrAEqK3ZRNn3lmfUUa1/SubscriberSchema.json>" %}

4. Open your file manager and head over to the folder where the `SubscriberSchema.json` file is located.
5. Drag the `SubscriberSchema.json` file to the **Entities** section in Rulecube and drop it.\
   ↳ Rulecube automatically creates a `SubscriberObject` entity based on the JSON schema:\ <img src="https://content.gitbook.com/content/BDcAUVq7N2h9LMSsD3S3/blobs/SlEwbXbHMgNb6K2IgPHK/image.png" alt="" data-size="original">

   1. Alternatively, if your browser does not allow drag and drop, you may upload this file under the Ruleset's Settings > Tools page.

This is cool. Just drop a JSON schema, and you've got a basic entity. You can do the same with an XSD, by the way. For now, you need to tweak the entity a little:

6. Click on the SubscriberObject entity and add a calculated property named `Age` and set its **Expression** to:

```javascript
AGE(dateOfBirth)
```

7. Add another calculated property named `SubscriptionAmount` and set its **Expression** to calculate the subscription amount based on the remaining days in the current year and the subscription cost per day:<br>

```javascript
DAYDIFF(TODAY(), TODAY().endOfYear()) * SubscriptionCostPerDay
```

That's it; your entity is ready and includes the calculated properties that you need in your software. To finish the ruleset, you have to set its input and output based on the entity:

8. Create an input named `Subscriber` and set its type to `SubscriberObject`.
9. Select the **Output** checkbox.
10. Save the ruleset and try it out.

Done. You're ready now to call your ruleset via its API from any software you like. Click **Docs > Examples** for a `fetch` snippet to call the ruleset from JavaScript.&#x20;

## What's next?

Follow our [How-to Guides](https://docs.rulecube.com/v2.3/how-to-guides) to add more functionality.&#x20;
