Timeline for Map returned to JS does not include null values
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 19, 2021 at 13:07 | vote | accept | Giorgos Galaios | ||
Jul 19, 2021 at 6:15 | comment | added | Giorgos Galaios | Let us continue this discussion in chat. | |
Jul 19, 2021 at 5:57 | comment | added | sfdcfox♦ |
@GiorgosGalaios Ah, yes... Well, going back to your original solution, then, you'll need to double-parse the JSON JSON.parse(JSON.parse(recordList))
|
|
Jul 19, 2021 at 5:53 | comment | added | Giorgos Galaios | thank you for the edits and all your advice. However, because my class implements and interface , it is needed to return a map of type <String, Object> as a response. So i cannot return a string to JS :( | |
Jul 19, 2021 at 5:48 | comment | added | sfdcfox♦ | @GiorgosGalaios See my edit. | |
Jul 19, 2021 at 5:48 | history | edited | sfdcfox♦ | CC BY-SA 4.0 |
added 274 characters in body
|
Jul 19, 2021 at 5:23 | comment | added | Giorgos Galaios | I am sorry, i meant ". This is what is shown in my serialized string. Not & it was my typo. So is this a normal behavior? What is the best way to handle this? I also shared the update in my code (just one line is the change i did) | |
Jul 18, 2021 at 15:25 | comment | added | sfdcfox♦ |
@GiorgosGalaios That shouldn't happen. & is for & , while " would have been encoded as " . There may be something else going on. Can you share the updated code?
|
|
Jul 18, 2021 at 10:51 | comment | added | Giorgos Galaios | Hi sfdcfox and thanks for your response. By doing JSON.serialize() in my Apex before returning the map it includes the null values, as you suggested. However i have the following problem: When i do the JSON.serialize() in my Apex, in the debug log the format is exactly what i want. However, when returned to JS, instead of ' "" ', i have the symbol &. Do you know why this happens and what i could do to handle this? Is it better to do a conversion in Apex or in JS? I tried to replace the ' & ' with ' " ', but without success. Any suggestions? | |
Jul 17, 2021 at 3:28 | history | answered | sfdcfox♦ | CC BY-SA 4.0 |