title: JSON to Java Objects, best practice for modeling the json stream
body: <p>I have a JSON stream being generated by a server side C++ program that is currently in development. I've been given a sample of the resulting JSON and I am concerned that I will have to parse the json by hand, that I won't be able to use normal class mapping provided by tools such as GSON or Jackson.</p>
  
  <p>Please take a look at the following (somewhat) contrived example they have provided. The sections I'm concerned with are the meta data "serie" array having different parameters. The key - "key" for example is present in only one of the array elements. Will this not cause issues trying to map this array to a collection of a specific class?</p>
  
  <p>Lastly, I am concerned that the "point" object is not similar. I have very limited understanding of JSON (being an old fashioned java swing developer) but the fact that the "point" key value pairs can be different - is a problem.</p>
  
  <p>The whole idea for this json stream is to describe a table, with ways of showing progress and to provide a mechanism for asking for "more" from the underlying hardware. Also if you are wondering why, I am sharing this datastream with a thin client (html browser).</p>
  
  <p>So am I correct that this will not easily convert to java objects?</p>
  
  <pre><code>{
    "abort": "abort;session=sessionname",
    "data": {
      "metadata": [
        {
          "protocol": "HTTP",
          "serie": [
            {
              "name": "k1",
              "description": "xDR ID",
              "tooltip": "ASDR Unique Identifier - UiD",
              "type": "int64",
              "key": "1"
            },
            {
              "name": "c1",
              "description": "Answered",
              "tooltip": "Request with Response",
              "type": "bool"
            },
            {
              "name": "c2",
              "description": "Active",
              "tooltip": "Session status: active or closed/down",
              "type": "bool"
            }
          ]
        },
        {
          "protocol": "DNS",
          "serie": [
            {
              "name": "k1",
              "description": "xDR ID",
              "tooltip": "ASDR Unique Identifier - UiD",
              "type": "int64",
              "key": "1"
            },
            {
              "name": "k2",
              "description": "Transaction ID",
              "type": "int64",
              "key": "1",
              "display": "number"
            },
            {
              "name": "k3",
              "description": "Client",
              "tooltip": "Source IP Address",
              "type": "string",
              "key": "1",
              "display": "ip"
            }
          ]
        }
      ],
      "summary": [
        {
          "timestamp": "1331192727",
          "protocol": "HTTP",
          "activity": "www.google.com",
          "results": "OK",
          "point": {
            "k1": "1",
            "c1": "true",
            "c2": "true"
          }
        },
        {
          "timestamp": "1331192727",
          "protocol": "DNS",
          "activity": "www.google.com",
          "results": "OK",
          "point": {
            "k1": "1",
            "k2": "1.1.4.229"
          }
        }
      ]
    },
    "progress": {
      "perc": "100"
    },
    "more": "13,39,1331192727,1331192760,27236,1.1.4.229,limit=1000,session=sessionname"
  }
  </code></pre>
  
  <p>Thank you for any advice you can provide.</p>
  
  <p>-D Klotz</p>