-
-
Save mykiy/ebc9e07eb5acba45eba08d781e2453d2 to your computer and use it in GitHub Desktop.
json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=> name/value pairs | |
{ | |
"name":"value" | |
} | |
=> supports | |
number, strings, boolean, nil, array | |
=> | |
{ | |
"name":"value", | |
"array": [ 1,2,3 ], | |
"boolean":false | |
"numbers":1 | |
} | |
array as json | |
------------ | |
[ | |
{ | |
"name":"value", | |
"boolean":true | |
} | |
] | |
json stringify | |
--- | |
converts json objects to an json strings. | |
my_obj = { | |
"name":"value" | |
} | |
j = json.Stringify(my_obj) | |
parse | |
--- | |
p = JSON.parse(json) | |
converts text into object notation | |
p ["name"] | |
=> | |
value | |
some nested | |
--- | |
{ | |
"name":"value", | |
"areas":[ | |
{ | |
"name":"mogappair_west" | |
}, | |
{ | |
"name":"Annanagar east" | |
} | |
], | |
"malls":[ | |
{ | |
"name":"EA" | |
} | |
, | |
{ | |
"name":"skywalk" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment