DEV Community

Cover image for JSON
NIKHIL GAUTAM
NIKHIL GAUTAM

Posted on

JSON

What is JSON ?

  • JavaScript Object Notation.
  • Lightweight data-interchange format.
  • Based on a subset of JavaScript.
  • Easy to read and write.
  • Often used with AJAX(Asynchronous JavaScript XML).
  • Can be used with most modern languages.

Data Types

Number : No difference between integer and floats.
String : string of Unicode characters. Use double quotes.
Boolean : True or False.
Array : Ordered list of 0 or more values.
Object : Unordered collection of key/value pairs.
Null : Empty values.

💡 Tip One way to remember JSON-valid data types: BASONN:

  • Booleans
  • Arrays
  • Strings
  • Objects
  • Numbers
  • Null

JSON Syntax Rules

  • Use key/value pairs - {"name":"John"}
  • Uses double quotes around KEY and VALUES.
  • Must use the specific data types.
  • File type is ".json".
  • MIME type is "Application/json".

JSON Example

{
    "name": "John",
    "age": 35,
    "address":{
        "street":"5 main street",
        "city": "Boston"
    },
    "children": ["Michel","Nick"]
}
Enter fullscreen mode Exit fullscreen mode

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay