Skip to main content

Hello,

I have a few ESRI generated json response files from ArcGIS Server feature service that can contain 1 to 200 records per response and these do not have geometry.

 

What I want to accomplish is to add one new parameter "projectnumber" and assign it with a static variable and rewrite the output back to JSON or ESRI JSON file again.

 

Thanks in advance !

 

Original:

{

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055647",

  "lifecyclestatus": 1,

  "GLOBALID": "{E839E029-529F-4D6B-9C4E-85BD875BC582}",

  "ASSETGROUP": 1

  }

 },

 {

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055649",

  "lifecyclestatus": 1,

  "GLOBALID": "{A9BF1A40-C1E4-4BC7-A538-7011FA9C55EA}",

  "ASSETGROUP": 1

  }

 },

 {

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055659",

  "lifecyclestatus": 1,

  "GLOBALID": "{2C931767-555B-44CB-B8B0-EFD345FCD324}",

  "ASSETGROUP": 1

  }

 }

 

Desired output:

 

{

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055647",

  "lifecyclestatus": 1,

  "GLOBALID": "{E839E029-529F-4D6B-9C4E-85BD875BC582}",

  "ASSETGROUP": 1,

"projectnumber": :123abc"

  }

 },

 {

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055649",

  "lifecyclestatus": 1,

  "GLOBALID": "{A9BF1A40-C1E4-4BC7-A538-7011FA9C55EA}",

  "ASSETGROUP": 1,

"projectnumber": :123abc"

  }

 },

 {

  "attributes": {

  "sapfloctplnr": "MASG-GASD-SA01-SERL-0055659",

  "lifecyclestatus": 1,

  "GLOBALID": "{2C931767-555B-44CB-B8B0-EFD345FCD324}",

  "ASSETGROUP": 1,

"projectnumber": :123abc"

  }

 }

Hi @litung8​,

You can use a JSONFragmenter to split up the source JSON into features. Set Flatten Query Result into attributes to Yes to extract the JSON info as attributes. Then use the JSONTemplater to build the new JSON, including the Project Number. I am attaching a workspace to illustrate.


You should also be able to use a JSONUpdater to do this


Hi @litung8​,

You can use a JSONFragmenter to split up the source JSON into features. Set Flatten Query Result into attributes to Yes to extract the JSON info as attributes. Then use the JSONTemplater to build the new JSON, including the Project Number. I am attaching a workspace to illustrate.

Thank you @daveatsafe​  This works great ! I spent many hours trying to get this output - you saved the day 🙂


Reply