XStream
  1. XStream
  2. XSTR-434

Strip root node generated JSON

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.3.1
    • Component/s: Core
    • Labels:
      None

      Description

      I want to use a resulting JSON formatted XStreamed object in a browser  
      in JS.

      The way JSON libraries typically works are to push the resulting  
      object into a closure :

      function (data) {
         // do something with data. like .....
         alert(data.field1)
      }

      Well that would be the case, but for objects that come from the two  
      JSON capable drivers in XStream, they are doing to look more like

      function (data) {
         alert(data.rootNode.field1)
      }

      'data' is prepended by the JSON libraries.  rootNode (more typically  
      the Java type name of the root node) is made by XStream.

      Could we have a mode of operation for the two JSON types that allowed  
      for "no root node" ?  Like so ..

         

      {"name" : "Fred", "sex" : "Male"}

      instead of ..

         {"MyPerson":

      {"name" : "Fred", "sex" : "Male"}

      }

        Issue Links

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Paul Hammant
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: