Solved

Practical use of JSON

Posted on 2010-11-23
7
291 Views
Last Modified: 2012-05-10
Hi Experts,
Please explain the propose of JSON and its use.  I know nothing about it.  Any practical use would be very beneficial.  I understand that it is very easy, but I can't imagine how.  Please help and thanks a lot in advance.
0
Comment
Question by:RadhaKrishnaKiJaya
  • 4
  • 3
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 34202658
As XML, JSON is a data format to send and retrieve data.
If you know the structure of a JSON object is easy to get specific data
JSON is lighter than XML
JSON is good to define objects
a car : { "car" : { "brand": "BMW" } ,"available_colors": ["red","blue","pink" ] }

A simple JSON object : {"state":true}

More info : http://json.org/
0
 

Author Comment

by:RadhaKrishnaKiJaya
ID: 34202704
Hi leakim971,
Thank you for your help.  I have saveral questions.  
1. Once the data is received in JSON format in a SQL table, how do we normally use it?  
2. What kind of data is normally converted to JSON (format) for sending and receiving?  
3. How do we convert them (I mean what kind of tool we use)?  
4. Finally how does any program read them (for example a C# program)?

Sorry for too many questions.  I am a beginner, so please help.  Thank you again.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 34202769
1) You've no direct method to parse and/or use JSON object with Database.
   Generaly you build JSON object from database data to send it back to the client and the invert process to stroe JSON object

2) any type of data. simple or complex object. Think JSON is lighter than XML

3) Check ths bottom of this page : http://json.org/
    You will find library to use it

4) the main process is generaly to rebuild the JSON object from a string. In c#, serialization, DataContract, JSONContract and so on... again check the bottom of the link you will see a lot of library
    with Javascript simple to build object from string : eval( "(" + jsonString +")" ) or JSON.parse on recent browser
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:RadhaKrishnaKiJaya
ID: 34287134
leakim971,
Hey, I really appricate all yoour help.  Thank you very much for your time.  Few more questions.

1. How the JSON is read in C#?
2. If we need to send some data in JSON, how we would be able to convert it in C#?
3. Please let me know how is it useful.

Thank you again for your help.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34287176
1) you unserialize the object with a c# object and you read value of the member
2) you serialize it...
3) JSON is light
0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 34320843
Thank you leakim971 for your wonderful help.  Before you leave, one last question, the serialize/unserialize  something we need to code in C# or use some tools?  Thank you again for your help.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 34320922
It depend the framework version you're using : http://www.west-wind.com/weblog/posts/442969.aspx

Thanks for the points! Have a nice week-end!

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now