• 0

Json ?


Question

hi I have tried reading the documentation on json but its not getting me anywhere ... I could tell you exactly what json is and does ....

json is a language which belongs to the javascript family blah blah blah it can be used to communicate between different languages and platforms ect ect .... but the thing is I have no idea how this thing is working can someone give me links to json / php to java tutorials that they have found usful ? or give me some small little bits of code so i can see what the hell is going on ? or give me some indepth explination to what i can do with this ? I need to learn it apparently

Link to comment
https://www.neowin.net/forum/topic/1127368-json/
Share on other sites

8 answers to this question

Recommended Posts

  • 0
or give me some indepth explination to what i can do with this ?

Familar with XML? Same kinda thing, just (in my opinion) better. It's just an easy standardized way for one program to talk to another.. regardless of who wrote it, if it properly parses JSON data, it'll get there unmangled. It's not a transport, just a way to ensure that program A can understand program B and vice versa. Some IDE's will have JSON parsers built in so you can view/serialize data a bit easier, there's some online too. Take your data, serialize it into JSON, and presto, you get something like below. The other program receives this then does it in reverse, and you get a "tree" which you should be able to easily visualize in your head with this example.


{
"firstName": "Max",
"address": {
"streetAddress": "123 Main St.",
"city": "Anytown",
"state": "US",
"postalCode": 12345
},
"phoneNumbers": [
"123-456-7890",
"123-555-1212"
]
}
[/CODE]

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595410430
Share on other sites

  • 0

JSON is merely a data-interchange format for passing data between programs written using various languages/technologies. Since it is widely used on the Internet and PHP has a habit of including the kitchen sink, it also has JSON encode and decode functions built-in (since PHP 5.2.1). The json_decode page in the PHP manual has not only function documentation but also several examples. You might also take a look at this StackOverflow question about parsing JSON in PHP. It has most of the code for a complete parser.

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595410434
Share on other sites

  • 0

Familar with XML? Same kinda thing, just (in my opinion) better. It's just an easy standardized way for one program to talk to another.. regardless of who wrote it, if it properly parses JSON data, it'll get there unmangled. It's not a transport, just a way to ensure that program A can understand program B and vice versa. Some IDE's will have JSON parsers built in so you can view/serialize data a bit easier, there's some online too. Take your data, serialize it into JSON, and presto, you get something like below. The other program receives this then does it in reverse, and you get a "tree" which you should be able to easily visualize in your head with this example.


{
"firstName": "Max",
"address": {
"streetAddress": "123 Main St.",
"city": "Anytown",
"state": "US",
"postalCode": 12345
},
"phoneNumbers": [
"123-456-7890",
"123-555-1212"
]
}
[/CODE]

oh that seems a bit long winded :/ I got my program at the moment posting to a php script then catching the response via datainputstream ... is this fine? or do you think Json would be better ? for large bits of information I send as 1 string with specific parameters so my java program can handle and string manipulate its self... I Dont know what i was hoping for with json but to me it does not sound that useful sounds like there are many alternatives... :(

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595410464
Share on other sites

  • 0

oh that seems a bit long winded :/ I got my program at the moment posting to a php script then catching the response via datainputstream ... is this fine? or do you think Json would be better ? for large bits of information I send as 1 string with specific parameters so my java program can handle and string manipulate its self... I Dont know what i was hoping for with json but to me it does not sound that useful sounds like there are many alternatives... :(

JSON would be what's received by the InputStream. It's not a replacement for any data socket handling things, it is the data. If your data needs lots of key-value things like you're sending objects, maps, or arrays across, then JSON would be good for your uses. It's not good for just straight strings or for binary data.

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595410504
Share on other sites

  • 0

To avoid stuff like that, you'll want to ensure that you're using a proper JSON encoder/decoder. JSON isn't actually JavaScript (It just shares the object notation, hence the name) and there's a bunch of subtle differences that can cause things to break if the parser isn't smart/good enough (Which is also another reason you never parse JSON using eval(), and be very very careful with "JSONP", grab it via XHR instead, etc.)

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595417088
Share on other sites

  • 0

JSON = JavaScript Object Notation. The name kinda explains what it is. It's simply a way of notating javascript objects so you can pass them around in a standardised, lightweight way.

BTW, if you're using Chrome, install the JSONView extension which will automatically format JSON responses into a nice readable display.

Link to comment
https://www.neowin.net/forum/topic/1127368-json/#findComment-595417190
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Can't reproduce. I installed Edge, went to neowin.net > accepted the cookie consent > used menu to go to forums, everything loads and I can browse around the forums. If you can't interact with the dialog on the forums for some reason, go to the main site and accept the cookie consent there? It is true that the site will not function properly until the cookie consent is accepted or rejected,. it's a legal requirement and I also know that certain VPN/ad blockers block it, which is a user related issue and not a neowin.net prolem. This is not our cookie consent dialog. Gotta love browser hijacking... /s
    • Google Chrome 149.0.7827.115 (offline installer) by Razvan Serea The web browser is arguably the most important piece of software on your computer. You spend much of your time online inside a browser: when you search, chat, email, shop, bank, read the news, and watch videos online, you often do all this using a browser. Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. Use one box for everything--type in the address bar and get suggestions for both search and Web pages. Thumbnails of your top sites let you access your favorite pages instantly with lightning speed from any new tab. Desktop shortcuts allow you to launch your favorite Web apps straight from your desktop. Chrome has many useful features built in, including automatic full-page translation and access to thousands of apps, extensions, and themes from the Chrome Web Store. Google Chrome is one of the best solutions for Internet browsing giving you high level of security, speed and great features. Important to know! The offline installer links do not include the automatic update feature. Download web installer: Google Chrome Web 32-bit | Google Chrome 64-bit | Freeware Download: Google Chrome Offline Installer 64-bit | Direct Link | 131.0 MB Download: Google Chrome Offline Installer 32-bit | Direct Link | 119.0 MB Download page: Google Chrome Portable Download: Chrome ARM64 | Direct Link View: Chrome Website | Release Notes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Oh, it's happening on more than one dialog? This is the dialog that I'm unable to interact with.
    • WSCC - Windows System Control Center 10.0.3.8 by Razvan Serea Windows System Control Center is a free, portable program that allows you to install, update, execute and organize the utilities from various system utility suites. WSCC can install and update the supported utilities automatically. Alternatively, WSCC can use the http protocol to download and run the programs. WSCC is portable, installation is not required. Extract the content of the downloaded zip archive to any directory on your computer. Free for personal use. The setup packages and updates are downloaded directly from their author's website! This edition of WSCC supports the following utility suites: Windows Sysinternals Suite (including support for "Sysinternals Live" service) NirSoft Utilities Mitec and more... WSCC - Windows System Control Center 10.0.3.8 changelog: [NEW] update progress is now visible on the Windows taskbar [FIXED] fixed an issue with the Update dialog [FIXED] minor fixes Download: WSCC (64-bit) | 5.4 MB (Free for personal use) Download: WSCC (32-bit) | 6.3 MB View: WSCC Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • The level of stupidity at Google and Microsoft is beyond belief. All they are doing by killing this is forcing people to jump over to Firefox and ditch them all together, therefore giving Firefox the market boost it needs to finally crush them all in the end.
  • Recent Achievements

    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
    • Week One Done
      Timaximus earned a badge
      Week One Done
    • Rookie
      FBSPL went up a rank
      Rookie
    • First Post
      davidbazooked earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      490
    2. 2
      PsYcHoKiLLa
      169
    3. 3
      +Edouard
      164
    4. 4
      Steven P.
      85
    5. 5
      ATLien_0
      77
  • Tell a friend

    Love Neowin? Tell a friend!