Get all updates of Java4s

What Is JSON, Complete Introduction To JSON

Json »on Feb 1, 2012 { 5 Comments } By Sivateja

JSON is JavaScript Object Notation [ it’s the damn default definition :-) ], and was invented by Douglas Crockford. Actually JSON is lightweight alternative to XML, language and platform independent script. Even JSON parsers & libraries are exists for many programming languages.

Converting JSON text to something in JavaScript will takes one line of code by using eval function ;) , to create an object from JSON text, just pass the string to eval function after surrounding the text with parentheses that’s it.

Creating JSON Object From JSON text

  • The variable names will hold the JSON text
  • Whole JSON text must be surrounded by quotes

Convert This Variable (names) Into JavaScript object

Actually we can convert JSON text into JavaScript object with eval function. eval() is the JavaScript function which converts JSON text into an JavaScript object, see this…

How To Access This JSON Object

Now you can print the values…

Note: Index always start from zero

Rather using eval() function It is safer to use a JSON parser to convert a JSON text to a JavaScript object. A JSON parser will recognize only JSON text and will not compile scripts, will see the complete example in the next tutorial.

You Might Also Like

  ::. About the Author .::

- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.


5 Responses to “What Is JSON, Complete Introduction To JSON”
  1. Hi, thank you for your tutorial.
    This are very useful to us. I want JUNIT tutorials with project example.
    Please share junit tutorial.
    Thank you for java4s

  2. Amit says:

    plz share junit tutorial.

  3. Hi,
    Can you please add MAVEN tutorials?

  4. RajaGopal says:

    HI siva your tutorial is very usefull to me thanks for giveing

    i want to expect SQL tutorial with queryes

  5. Narendra says:

    Hi, Java4s team.
    Thanks a lot for helping us in a simple and easy way


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Spring-Boot-tutorials Hibernate tutorials Spring tutorials Struts tutorials Servlets tutorials Ajax tutorials Log4j tutorials jQuery tutorials Json tutorials Core Java tutorials Web Services tutorials AngularJs tutorials
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.