1

I have a stored data as JSON and I want to convert it to object in order to fill a <apex:pageBlockTable> with it.

Is there a library I can use like GSON library ? Or what is the best thing to do ?

1 Answer 1

8

Apex has a native JSON support

You can use the serialise and deserialise methods.

Here is a round-trip example and if that doesn't work for you or you have more complex data, consider using the JSON parser

Also have a look at these examples

2
  • But in this serialization process, the JSON structure has to suit the object structure. I want to serialize JSON data to an object without specifying attributes to suit the JSON data. Exactly like JavaScript. is it possible ? Commented Nov 2, 2014 at 10:43
  • 2
    @HasanKhatib The serializeUntyped method allows this.
    – Keith C
    Commented Nov 2, 2014 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .