git clone [email protected]:ramyaragupathy/json-parser.git
npm install
npm install json-rdparse -g
json-rdparse <filepath>
JSON (JavaScript Object Notation) is a way to pack an object into a string, so that it can be transferred somewhere & later unpacked into an object. It is textual, language-independent, data exchange format similar to CSV, XML, YAML,etc.
JSON got its origin based on how Javascript object works. However it is not limited to just Javascript. It is used in other languages as well.
The process of converting an object into a string (byte format) is called serialisation/marshalling.
The process of converting a string into object or extracting data structure from a series of bytes is called deserialisation/unmarshalling.
Objects in different programming languages are represented/strucutred differently. What is valid in Javascript might not be recognisable in C++/Java because they represent objects differently. A data exchange format like JSON enables structured information transfer between programming languages.
Here I'm listing a few scenarios based on RFC 7159 standard. Online validators gives results based on the standard adapted in their websites. Most recent specifiation is RFC 8259 released in December 2017.
Valid
0
,[]
,{}
,""
,[1,2,3]
,["1", "2", 3]
,["1", "2", 3]
,"abc"
,"abc\""
,"abc\u0123"
,{"a":"b"}
,{"a":8}
, {"a":{"b":{"c":"d"}}}
Invalid
01
, [
, }
,''
, [1,]
,['1','2', '3']
,"abc
,"abc\"
,"abc\u012"
,{'a':'b'}
, {a:8}