Deserialize JSON activity

Hi

I will have to deserialize json files in UiPath, but I have a some problem. Example file looks like that:

{“Invoice”:{“ID”:3,“NIP”:“111-111-11-11”,“InvoiceID”:“FS 12756/2020”,“IssueDate”:“2020-09-28”,“MPK”:[{“@odata.type”:“#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,“Id”:33,“Value”:“[530] Shared Services”}]}}

so I can use Deserialize JSON activity and I can read values from InvoiceID,IssueDate etc. by

variable(“Invoice”)(“IssueDate”).ToString

but if I want read (for example) value from “MPK” by variable(“Invoice”)(“MPK”)(“ID”).ToString I get error. In json file this values in How can I do it ?

Thanks for advice.

Hello @kilerfcb,

Can you try :
variable(“Invoice”)(“MPK”)(0)(“ID”).ToString

Hi @kilerfcb

You can check this post might help you.

Thanks
Latika

I have next problem. Finally I have Json file in this format like on screenshot.Untitled

But in “InvoiceElements” section in each file may be different number of items. How can I get count of this elements ?