arraysjsonapex-codeapex

How to convert json array to json?


I am New to APEX programming language.I am having JSON Array string i only need to convert it into JSON Object i.e I need to remove [] from the array. Example:

[{"Attributes":
 {"Type":"Account","url";"/servicec/data/v4.0"},"LastModified":"2017-05-05"}]

I need to Convert Above Json Array to

{"Attributes":
{"Type":"Account","url";"/servicec/data/v4.0"},"LastModified":"2017-05-05"}

Solution

  • List<Object> arr =(List<Object>)JSON.deserializeUntyped(jsonInput);
    String firstemement = arr[0];