Get Data From Json and Save Into a Variable

Hi All,

I was able to get the data from external System with a!httpQuery and using a!fromJson() I could able to get the data in the below format.
[{"EMP_ID":1,"EMP_NAME":"ABC","ORG":"VPC","MANAGER_CONTACT_NAME":"My Name"}],
So could someone help me how to save this single text value, into a CDT or basically what I want is the Values for those respective properties.
TIA :)

OriginalPostID-231320

  Discussion posts and replies are publicly visible

Parents
  • I think you need to provide a bit more context about what you're trying to achieve. You do not need to transform the JSON to a CDT unless you NEED that CDT for a specific purpose, and that's the bit we're missing from your description (e.g. if you want to store the data in a Database using Appian's Write to Datastore capability then, yes, a CDT will be required). If you just want to throw the data onto a User Interface you could just transform the JSON into a Dictionary - using a!fromJson() - and work with that natively...

  • Hi,

    Based on my json script I want to create input fields such as text, integer, dropdown in interface by passing json values.

    for eg. [{"filedname": "text"}, {"filedname": "integer"}] so it should create a text and an integer field based on whatever value I am passing in fieldname key

    How I can achieve that?

Reply Children
  • 0
    Certified Lead Developer
    in reply to priyankadubey

    First, create interface, just leave blank for now.

    Make a!localVariables, make a local variable to save JSON data.  Use the fromJson() to convert a JSON document you downloaded into a dictionary.

    Now, create a text field, set it to read-only, set the value to the localVariable you made, local!jsonStorage or whatever you named it.  Now your interface should be displaying the whole dictionary that came from your JSON.

    Make a new text field, set it readOnly and set it's value to index(local!jsonStorage, "fieldOne", ""), now see output of that.  Since you're starting out, it's going to be little by little, but soon you should have all the fields displaying the data from the JSON exactly how you want.

    Then try to figure out how to get the users to edit them, then possibly cast that dictionary as a CDT.  Maybe even use toJSON() to output json depending on your

  • 0
    Certified Lead Developer
    in reply to priyankadubey

    And a third time! What is your use case?!? Please, tell us what you want to achieve and for what purpose and we can help.