John Cooper
John Cooper

Reputation: 7641

Complex JSON and Tutorials

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.

Upvotes: 8

Views: 10630

Answers (2)

haylem
haylem

Reputation: 22663

Basics

Get (a lot) more involved...

Check out JSON processors and libraries

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.

Learn about JSON variants and JSON-based concepts

Experiment with some JSON endpoints

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.

Upvotes: 34

Tadeck
Tadeck

Reputation: 137390

JSON has following types of elements:

  • objects (eg. {} or { something: 'somevalue' }, JSON itself),
  • arrays (eg. [] or [1, 'test', false, true, false, 1, 22, 33]),
  • boolean (true or false),
  • integers (eg. 0, 10, -23342),
  • floats (eg. 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.

Upvotes: 5

Related Questions