Skip to main content
saurabhs0003
March 23, 2023
Question

how to fetch specific value from json

  • March 23, 2023
  • 12 replies
  • 0 views

Hi All , 

I have values stored in database in a particular field i.e. say previousValues, like below 

    • "{"name":"xyz","regDate":"2012-07-01","regStatus":"Completed"}"  --   (Text)

      Now my requirement is to fetch regStatus value from this format . 

      How can I achieve this

      12 replies

      mikes0011
      Brainy
      March 23, 2023

      You will need to read up on the built-in JSON functions - a!toJson(), and (the one you need) a!fromJson().  Passing your text string through this rule will return a dictionary value, from which you can directly pull the named property by the normal means including just using the dot property (i.e. "local!result.regStatus") or by use of the "property()" function, i.e. "property(local!result, "regStatus", null())".

      saurabhs0003
      March 23, 2023

      Hi Mike,

      I received this below error 

      The value parameter must be a CDT, a dictionary, a map, a record, or a list. Received type: [Text],

      mikes0011
      Brainy
      March 23, 2023

      Please share a code snippet for what you're trying.  It works right away when I try it.