Formatting JSON Attribute in ArcGIS Online Pop-ups

722
2
Jump to solution
10-10-2022 12:03 PM
Labels (2)
Shelley_Broadway
New Contributor

Is there a way to format JSON in an attribute column so that it's easier to read in the map pop-ups? For example, one of the fields in my data contains JSON --

[{"Data_ID":"XXXXXXX","FormDataID":"YYYYYYY","FID":"Lines_p2.atyo12lfi98009938809876344560","Owner":"Example","Material_Type":"P ","Size":"7","Misc_Notes":null,"Permit_No":null}]

 

I want to pull out Owner, Material, and Size and show in the pop-up. Can this be done with Arcade?

0 Kudos
1 Solution

Accepted Solutions
PeterMilenkovic
Occasional Contributor

Yep

Create a variable using your $feature.FieldName, then call out the bits in whatever format you want.

 

Eg

 

var json=  {"Data_ID":"XXXXXXX","FormDataID":"YYYYYYY",
            "FID":"Lines_p2.atyo12lfi98009938809876344560",
            "Owner":"Example","Material_Type":"P ","Size":"7",
            "Misc_Notes":null,"Permit_No":null}

return 'Owner: ' + json.Owner + textformatting.newline +
       'Material: ' + json.Material_Type + textformatting.newline +
       'Size: ' + json.Size

View solution in original post

2 Replies
PeterMilenkovic
Occasional Contributor

Yep

Create a variable using your $feature.FieldName, then call out the bits in whatever format you want.

 

Eg

 

var json=  {"Data_ID":"XXXXXXX","FormDataID":"YYYYYYY",
            "FID":"Lines_p2.atyo12lfi98009938809876344560",
            "Owner":"Example","Material_Type":"P ","Size":"7",
            "Misc_Notes":null,"Permit_No":null}

return 'Owner: ' + json.Owner + textformatting.newline +
       'Material: ' + json.Material_Type + textformatting.newline +
       'Size: ' + json.Size
Shelley_Broadway
New Contributor

That worked. Thank you, Peter!

0 Kudos