2 Replies Latest reply: Jun 13, 2018 5:00 AM by Jon Erik Lindberg RSS

    JSON parsing problem

    Jon Erik Lindberg

      I try to parse JSON code formatted like this:

      [ { "nsrId": "1020895", "koordinatLatLng": [ 59.7626, 10.03038 ], "navn": "Stenseth barnehage", "fylkesnummer": "06", "kommunenummer": "0625", "alder": "1 - 5", "eierform": "Privat", "antallBarn": 77 },.........

       

       

      My Rest connection generates this code:

      ----------------------

      RestConnectorMasterTable:

      SQL SELECT

      "nsrId",

      "navn",

      "fylkesnummer",

      "kommunenummer",

      "alder",

      "eierform",

      "antallBarn",

      "__KEY_root",

      (SELECT

      "@Value",

      "__FK_koordinatLatLng"

      FROM "koordinatLatLng" FK "__FK_koordinatLatLng" ArrayValueAlias "@Value")

      FROM JSON (wrap on) "root" PK "__KEY_root";

       

      [koordinatLatLng]:

      LOAD [@Value] AS [Lat],

      [__FK_koordinatLatLng] AS [__KEY_root]

      RESIDENT RestConnectorMasterTable

      WHERE NOT IsNull([__FK_koordinatLatLng]);

       

      [root]:

      LOAD [nsrId] AS [nsrId],

      [navn] AS [Barnehage],

      [kommunenummer] AS [Kommunenummer],

      [alder] AS [Aldersspenn],

      [eierform] AS [Eierform],

      [antallBarn] AS [Antall barn],

      [__KEY_root] AS [__KEY_root]

      RESIDENT RestConnectorMasterTable

      WHERE NOT IsNull([__KEY_root]);

       

      DROP TABLE RestConnectorMasterTable;

      ------------------------------

       

      My problem is that latitude/longitude ("koordinatLatLng": [ 59.7626, 10.03038 ]) is read like a sum. I need to read latitude and longitude as separate entities but I cannot figure out how to change the code to accomplish that.