Simple Site - JSON Files

What is JSON?

JSON stands for JavaScript Object Notation and is a lightweight format for storing and transporting data. It should be relatively "self-describing" and easy to understand[1].

JSON files are organised in comma separated name/value pairs held within curly brackets, with additional non-named lists held within square brackets. It is also important to ensure that none of the names or values include any newline characters or special JSON characters. There are a large number of websites describing all of the details and rules of the JSON format, but unless you would really like to learn there is a simple solution. If in doubt just copy and paste you name or value text into an online JSON formatting tool and let it do the work[2] for you, then copy the processed text into your file and move on.

There are many of these tools online, such as:/p>

{
  "DataSetName": {
    "Name": "Value",
    "Another Name": "Another Value",
    "List Name(for example shapes)": [
      {"shape": "square", "colour": "blue"},
      {"shape": "circle", "colour": "red"},
      {"shape": "triangle", "colour": "yellow"}
      ]
  }
}
Simplified example of a JSON data object.

In addition to ensuring that individual name of value texts are correctly processed it is also common, when editing an existing JSON file to make small errors, forgetting a comma, or a double quotes, etc. If your files start to get longer it is often useful just to check that your file is still a valid JSON file before submitting it. As with the escape process above there are a number of free online tools to do this, such as:


Display the full code used to define this page.

Page JSON Object

{
    "parent": "documentation",
    "class": "",
    "file": "",
    "title": "Simple Site - JSON Files",
    "content": "<h3>What is JSON?</h3>\r\n<p>JSON stands for <b>J</b>ava<b>S</b>cript <b>O</b>bject <b>N</b>otation and is a lightweight format for storing and transporting data. It should be relatively \"self-describing\" and easy to understand[@@https://www.w3schools.com/whatis/whatis_json.asp].</p>\r\n\r\n<p>JSON files are organised in comma separated name/value pairs held within curly brackets, with additional non-named lists held within square brackets. It is also important to ensure that none of the names or values include any newline characters or special JSON characters. There are a large number of websites describing all of the details and rules of the JSON format, but unless you would really like to learn there is a simple solution. If in doubt just copy and paste you name or value text into an online JSON formatting tool and let it do the work[@@https://en.wikipedia.org/wiki/Escape_character] for you, then copy the processed text into your file and move on.</p>\r\n\r\n<p>There are many of these tools online, such as:/p>\r\n<ul>\r\n<li>[www.freeformatter.com|https://www.freeformatter.com/json-escape.html]</li>\r\n<li>[codebeautify.org|https://codebeautify.org/json-escape-unescape]</li>\r\n<li>Or simply explore [Google|https://www.google.com/search?q=escape+json].</li>\r\n</ul>\r\n\r\n<figure>\r\n\t\t<pre style=\"overflow: hidden;border: 2px solid black;padding: 10px;\">\r\n<code>{\r\n  \"<b>DataSetName</b>\": {\r\n    \"<b>Name</b>\": \"Value\",\r\n    \"<b>Another Name</b>\": \"Another Value\",\r\n    \"<b>List Name(for example shapes)</b>\": [\r\n      {\"shape\": \"square\", \"colour\": \"blue\"},\r\n      {\"shape\": \"circle\", \"colour\": \"red\"},\r\n      {\"shape\": \"triangle\", \"colour\": \"yellow\"}\r\n      ]\r\n  }\r\n}\r\n</code></pre><figcaption class=\"figure-caption\">Simplified example of a JSON data object.</figcaption>\r\n</figure>\r\n\r\n<p>In addition to ensuring that individual name of value texts are correctly processed it is also common, when editing an existing JSON file to make small errors, forgetting a comma, or a double quotes, etc. If your files start to get longer it is often useful just to check that your file is still a valid JSON file before submitting it. As with the escape process above there are a number of free online tools to do this, such as:</p>\r\n<ul>\r\n\t<li>[jsonlint.com|https://jsonlint.com/]</li>\r\n\t<li>[www.freeformatter.com|https://www.freeformatter.com/json-validator.html]</li>\r\n\t<li>Or simply explore [Google|https://www.google.com/search?q=validate+json].</li>\r\n</ul>\r\n<div class=\"alert alert-info\" role=\"alert\"><h4 class=\"alert-heading\">Take Care</h4><p>Ensure your text values have been correctly [escaped|https://www.freeformatter.com/json-escape.html] &#8608; and check your JSON files are [valid|https://jsonlint.com/] before submitting them!</p></div>",
    "content right": "",
    "copy": true,
    "displayName": "JSON Files",
    "displaycode": true
}
The complete JSON object used to define this content and layout of this page.