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

Top comments (0)

Cloudinary image

Zoom pan, gen fill, restore, overlay, upscale, crop, resize...

Chain advanced transformations through a set of image and video APIs while optimizing assets by 90%.

Explore

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay