This article covers how to format and save your data in JSON format before uploading to EmcienPatterns.
JSON format contains no headers and is an industry standard format for data storage. JSON files are great for transactional data containing many variables and combinations, and supports large item “baskets” that have up to 1000 items per transaction.
Formatting
JSON format consists of one valid JSON object per line, where every line is a transaction. There are a maximum of 1000 categories per data file, and a maximum of 1000 entries per transaction. An example of the JSON format is below:
Some important things to note about JSON Format:
- Items are placed in the data set with the form of “category”:”item”
- All strings must be escaped as JSON strings, with a backslash before the character to be escaped.
- If a line contains a transaction id, it must be labeled with either “tid” or “transaction_id”,
- Each line is required to have at least one item, and it must be labeled with either “id” or”sku”. Items may include any of the following details:
- “id” or “sku”- the identifying string of characters for that item
- “name”, “desc”, or “description”- the item's name
- “cat”, “category”, or “group”- the item category
- “price” or “value- A float value of up to 7 digits with the items price, not to be encased in double quotes
- “volume”- a float value of the number of the specific items purchased, in the same format as the price
Date Format Details
The date column can have 4 different formats. Below are possible examples of what they may be.
Format |
Example |
YYYY-MM-DD | 2012-07-15 |
YYYY-MM-DDTHH:MM:SS | 2012-07-15T02:23:44 (T, t or space must be present between date and time; Z, z, or nothing after time) |
unixtime | 1431209618 (assumed time zone is UTC+0; 1-10 digit numer) |
none | No value is requred |
Not sure which format is best for you? The Emcien team can help prepare your data. Contact us at .