How to read from a Dictionary

HI,

I am trying to read from a Dictionary output provided by the box connected system as shown below . How to read each items such as ID and type to a local variable ?

I tried fn!index(local!folderContents,"id") but it is giving me null output 

Please help me 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Your dictionary is nested to a few levels, so you can't access the "id" property just from the top.

    The easiest way to figure this out is do it one step at a time.

    First write local!folderContents.result to access entries; then to access a specific entry you can write local!folderContents.result.entries[1]; finally you can access the id property within the specific entry by expanding that to local!folderContents.result.entries[1].id.  Finally, if you really want the id field within "file_version", you will need to reach one level further down.

    The index() and property() functions are useful for doing null-safe indexing, but when you're sure of the shape of the data you'll get, you can access the properties and indexes directly as written above.

Reply
  • 0
    Certified Lead Developer

    Your dictionary is nested to a few levels, so you can't access the "id" property just from the top.

    The easiest way to figure this out is do it one step at a time.

    First write local!folderContents.result to access entries; then to access a specific entry you can write local!folderContents.result.entries[1]; finally you can access the id property within the specific entry by expanding that to local!folderContents.result.entries[1].id.  Finally, if you really want the id field within "file_version", you will need to reach one level further down.

    The index() and property() functions are useful for doing null-safe indexing, but when you're sure of the shape of the data you'll get, you can access the properties and indexes directly as written above.

Children