JSON Deserialize from JSON literal
Question
Application Type
Reactive
Service Studio Version
11.50.9 (Build 46307)
Platform Version
11.13.0 (Build 31007)

Hi!


I'm trying to deserialize this JSON:

"[{
  'qcentity': [
    {
      'id': 1,
      'name': 'China Office'
    },
    {
      'id': 2,
      'name': 'External Entity'
    },
    {
      'id': 3,
      'name': 'Citeve'
    },
    {
      'id': 4,
      'name': 'Intertek Portugal'
    },
    {
      'id': 5,
      'name': 'BVCTP'
    },
    {
      'id': 6,
      'name': 'SGS Portugal S.A.'
    },
    {
      'id': 7,
      'name': 'TUV Rheinland'
    },
    {
      'id': 8,
      'name': 'TUV SUD AV'
    }
  ]
}]"

My datatype is a List of Structure with attributes Id and Name.

However, no data is created on the object.


Can someone help?


Regards,


Andi

Solution

The JSON literal was wrong formatted.

The correct JSON should be:

"[

{

""Id"":""PM-001"",

""Name"":""LC""

},

{

""Id"":""PM-002"",

""Name"":""Swift""

}

]"

yes indeed,

single quotes won't work

Hi Andi,

Your JSON is not a list of id/name items, but a list of qcentity, which in it´ s turn is a list of id/name.

You structure will have to represent that.

Dorine


Solution

The JSON literal was wrong formatted.

The correct JSON should be:

"[

{

""Id"":""PM-001"",

""Name"":""LC""

},

{

""Id"":""PM-002"",

""Name"":""Swift""

}

]"

yes indeed,

single quotes won't work

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.