Create a feature from JSON feed with array of attributes

2276
5
01-30-2017 04:44 PM
RomanChueh
New Contributor III

Is it possible to add/update feature class from a JSON feed below:

{
   "cars": [{
      "manufacturer": "Honda",
      "attribute": [{
            "Label": "Name",
            "value": "Accord"
         }, {
            "Label": "Year",

            "value": 2007
         }, {
            "Label": "Weight",
            "value": 3000
         }]
      }, {

         "manufacturer": "Toyota",
         "attribute": [{
            "Label": "Name",
            "value": "Camery"
          }, {
            "Label": "Year",
            "value": 2010
         }, {
            "Label": "Passengers",
            "value": 5
         }]
    }]
}

A GeoEvent definition was created after I created an Input connector consuming the JSON.

How do I map this GeoEvent so that I can update to a Feature Class through a feature service with fields: Manufacturers, Name, Year, Weight, Passengers?

Thanks

5 Replies
Jean-PierreDEBOOS1
Esri Contributor

Hi,

did you find a solution ? i have the same question with my json (https://community.esri.com/thread/213590-parsing-json-for-iot-experimentation)

0 Kudos
RomanChueh
New Contributor III

No. I didn't find a solution for the problem. 

0 Kudos
Jean-PierreDEBOOS1
Esri Contributor

We found a solution.  I have no time to explain now but i will try tomorow.

0 Kudos
Jean-PierreDEBOOS1
Esri Contributor
0 Kudos
AnninaHirschi_Wyss1
Occasional Contributor III

Did you try to create a "flat" GeoEventDefinition with the attributes that match your Feature Service and then create a field mapper in the service definition? In the input connector you leave what is automatically generated.

It doesn't look like that your json has a geometry, true? If yes, you need to create one as well in your custom definition (with the type geometry and the tag GEOMETRY).

In my case, there is no geometry, so I created the service with the points in Desktop and added the table and the relationship class (1:M) in the GDB before publishing the service. The GeoEvent Service writes the results into that related table.

Would this be suitable use case for you as well?

0 Kudos