Timeline for JSON.exceptions when inserting JSON objects inside a larger whole
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 27, 2018 at 17:45 | comment | added | Duncan Stewart | Nice. :D @sfdcfox | |
Jul 27, 2018 at 17:44 | vote | accept | Duncan Stewart | ||
Jul 27, 2018 at 17:35 | comment | added | sfdcfox♦ |
@DuncanStewart Actually, it was mistyped. I wasn't paying attention. You use the key => value syntax. See my edit. And yes, the order will probably be different; JSONGenerator explicitly allows you to order the values, but it shouldn't matter; any proper JSON parser shouldn't care about order.
|
|
Jul 27, 2018 at 17:34 | history | edited | sfdcfox♦ | CC BY-SA 4.0 |
added 14 characters in body
|
Jul 27, 2018 at 17:33 | comment | added | Duncan Stewart | Very clean! I haven't come across that particular syntax for creating a map (and maybe it works with some additional '{}' around the lines?) - I ended up going with the old-fashioned Map<String, Object> thisMap = new Map<String, Object>();, and then added each line separately using thisMap.put('Phone', ivr.Phone__c), for instance. I do need additional values outside this list, which did result in a different order when I used JSON.serialize() vs. JSONGenerator, but it shouldn't make a difference..? I'll find out :D | |
Jul 27, 2018 at 16:47 | history | answered | sfdcfox♦ | CC BY-SA 4.0 |