Can anyone show me some complex JSON structure and tutorials where i can excel more on this JSON topic using javascript
. So far i am able to understand JSON, its basic structure and how to parse and alert out properties.
I can search in google or other search engines, but i want links from you expert guys who can lead me to right direction than a BOT which displays result.
Complex JSON objects are those objects that contain a nested object inside the other. Example of Complex JSON Object.
At the granular level, JSON consists of 6 data types. The first four data types (string, number, boolean and null) can be referred to as simple data types. The other two data types (object and array) can be referred to as complex data types.
JSON is easier to use than XML and human readable. Most modern web APIs output data in JSON formats. It's a lightweight data interchange format that is quickly becoming the default format for data exchange on internet today! JSON is lightweight, language independent and easy to read and write.
JSON defines seven value types: string, number, object, array, true, false, and null. The following example shows JSON data for a sample object that contains name-value pairs.
JSON
object, JSON.parse
and JSON.stringify
If you have some knowledge of other languages, you could look at some JSON processors' implementations and get to know what makes them better or worse than their competitors, read their code, etc...
For instance, for Java:
For other languages: see json.org (at the bottom of the page) for tons of links.
Look online for webservices exposing JSON-enabled endpoints to play with them. Head over to ProgrammableWeb for that, or use any search engine.
For experimenting, use either:
Actually you could very much just use your javascript console to experiment without any end-point and test whether you manage to create objects.
JSON has following types of elements:
{}
or { something: 'somevalue' }
, JSON itself),[]
or [1, 'test', false, true, false, 1, 22, 33]
),true
or false
),0
, 10
, -23342
),0.2
, 3.1415
, -321312.01
),null
,So to construct some complicated JSON you can just combine all of the above and assign it to some variable:
var myjson = {
myame: 'Tadeck',
myinterests: [
'programming',
'games',
'artificial intelligence',
'business models'
],
mydata: {
'age': 'not your business',
'something': 'das',
'friends': [
'A',
'B',
'C'
]
},
facebook_friends_count: 0,
iq: 74.5,
answered_your_question: true,
answer_sufficient: null,
question_can_be_answered_better: false,
solutions: [
'read about JSON',
'test JSON in JavaScript',
'maybe test JSON in different languages',
'learn how to encode some special characters in JSON'
]
}
Then play with it in JavaScript and remember that this is the way objects are noted in JavaScript. This is simple, yet very powerful solution (used eg. by Twitter).
If this will not help (btw. again: visit JSON.org), I have one more advice for you: practice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With