0

I'm kind of new to dealing with Json and other web-related formats, and I want to basically take the "stuff" in this json, and store some of the information into variables in a Java program. If my understanding is correct, this process is called deserialization, and I've heard about using Gson to do this, but I'm not sure if that would be the best method. In a pseudo-code example, this is what I want to accomplish:

Object obj = JsonThing.getJsonFromUrl("http://steamcommunity.com/market/search/render/?query=&start=0&count=10&search_descriptions=0&sort_column=quantity&sort_dir=desc&appid=730");

Double price = obj.itemPrice;
String name = obj.itemName;

Where "price" and "name" would be the first of each element in th json that I want to get, and it would loop through to get the others (maybe put them in an array?). I don't know how this would work exactly, so could someone give me a code example?

daltonv297
  • 161
  • 5
  • 14
  • GSON is a really good api. Disregard the nay sayers!! But you need to develop a better understanding of what GSON is for. – christopher May 18 '15 at 17:25
  • TL;DR? OP added tag `gson`. So: 1. Create an Object that has the same variables as the json message. 2. Call gson.fromJson(..). But for details first try yourself with help of [gson doc](https://sites.google.com/site/gson/gson-user-guide) – MalaKa May 18 '15 at 17:26
  • @christopher let's not turn this question nor comments into a flame war between Gson and Jackson. But anyway, I tested both and Jackson was the best by far (please also read the sarcasm in the comment). – Luiggi Mendoza May 18 '15 at 17:27
  • @MalaKa and all that is covered in the duplicate Q/A (that seems you haven't even check). – Luiggi Mendoza May 18 '15 at 17:28
  • @LuiggiMendoza I can flame with the best of them you... you.. dunderhead. Yeah. Burn. – christopher May 18 '15 at 19:47

0 Answers0