Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [serialize]

The tag has no usage guidance.

3
votes
3answers
486 views

JSON.serialize: is it possible to suppress null values of a map?

I tried to serialize a map with null value (api 45): Map<String, String> bodyMap = new Map<String, String> {'key'=>'value', 'key2'=>null}; System.debug(JSON.serialize(bodyMap,true));...
0
votes
1answer
42 views

How to serialize a custom Salesforce Class object with nested objects to json

I am a noob on serialising in SF. I have a SF object which i Want to serialise to JSON. The object contains nested data. Do I need to create all the nested data first an add these to the outer ...
0
votes
0answers
28 views

Issue with the JSON object serialize [duplicate]

I am retrieving the list of all the fields and trying to serialize. Using the code snippet below allfieldNames contains around 400 fields but Data >>> contains information related to only 100 random ...
2
votes
1answer
332 views

Date Json.serialize removes 00:00:00 digits from datefields of object

I have the following object (invMappingNew): {customerId__c=1, addressId__c=8212BJ154, invoiceType__c=AdvancePayment, invoiceTypeLocalized__c=Voorschot, invoiceDate__c=2015-02-13 00:00:00, ...
5
votes
1answer
869 views

JSON serialize SObject including fields with null values

I've currently got a use case where I would like to JSON serialize an SObject, but include fields with null (blank) values. According to the documentation (https://developer.salesforce.com/docs/atlas....
1
vote
1answer
343 views

JSON deserialize from another managed package

In Salesforce if you try and do this: JSON.serialize(data); where data is an instance of a global Apex class in another managed package it will fail. This seems like a completely arbitrary and ...
0
votes
1answer
331 views

How to: JSON Serialize a node/list instead of a field

I have my class for serialize variables, but items and fields should be nodes not fields, I need to get this output: { "items": [ { "email": "string", "fields": [ { ...
8
votes
1answer
3k views

How to JSON.serialize not including null values

I have an Issue. I have a class with few Strings public class DopplerJSONSerializer { public String name; public String email; } In some, I need to serialize and use only the name String in ...
3
votes
2answers
6k views

Serialize a Map into a specific JSON object

I built a Map and serialize into a JSON object, my code below: Map<String,List<String>> mapTypeSubType= new Map<String,List<String>>(); if(actionPlanB2C.size()>0){ ...
1
vote
2answers
994 views

Json serialize not giving me correct format

My end result needs to be something like this: [{ "label": "Sales", "color": "#9cd159", "data": [ ["Jan", 27], ["Feb", 82], ["Mar", 56], ["Oct", ...
4
votes
2answers
281 views

Deserialise json in apex

How to deserialize the below json ? I want to retrieve messages only in list of string . { "posts": { "data": [ { "message": "Hello. My name is sdfd. How can I help you?", "created_time": "...
0
votes
1answer
58 views

Serialized JSON for POST to server not taking

I am following this simple example List<Account> accounts = [SELECT id, name FROM Account LIMIT 2]; String accountsJSON = JSON.serializePretty(accounts); I am trying to replicate this exactly ...
1
vote
1answer
251 views

Substring for a specific value

I have below string value from which I need a specific section to put in another string. Can someone please help? String [{"attributes":{"type":"Call2_vod__c","url":"/services/data/v37.0/sobjects/...
0
votes
1answer
1k views

how to use JSON.serialize() on a wrapper class ?

I want to use AngularJs in a my page to filter a list of records, i found this article very helpful. the problem is in the article, the JSON.serialize is applied on a list like this public static ...
2
votes
2answers
2k views

JSON Serialize returning html entities that are not encoded

I am getting data from a custom field(Article__c) on a Knowledge Article which contains HTML data. When I serialize this data and return it to a VF page I am getting HTML characters that should be ...
2
votes
2answers
3k views

What XML support salesforce provides in apex

(i) Is it possible to directly serialize/deserialize sObject record to xml in apex code? (ii) Is it possible to serialize/deserialize apex object to/from xml?
2
votes
1answer
1k views

Changing property names when serializing JSON [duplicate]

Is there any way to set the name of the serializable field? I'm trying to work with JIRA webhooks and I ran into an issue where their request package contains a field that is a protected keyword in ...
3
votes
1answer
404 views

JSON Serialize Anything

Sometimes as quick and drity debugging/introspection I leverage System.assert(false, JSON.serializePretty(<target>)) but it does not always work depending on target, ex: System....
1
vote
1answer
53 views

Deserialize and reserialize SOobject

i have an object like this: evticket__c et = [Select Id from evticket__c where Id =: id limit 1]; then i serialize it likethis: String obj = JSON.serialize(et); is there a way to create a new ...
-3
votes
1answer
2k views

why we need to serialize and deserialize

why we need to serialize and deserialize? Why don't we save the value directly into database with out serialize. What is the benefit for doing serialize. I know that by doing serialize it will get ...
2
votes
2answers
986 views

How get all objects and their fields as Json

By means of Schema.getGlobalDescribe.Values () getDescribe ().getName () can receive names of objects.With Using method getDescribe().fields.getMap() we can get fields of object. It is necessary to ...
6
votes
1answer
2k views

With JSON - How to serialize the Account's Shipping and Billing Address?

I want to serialize just the Address object (lets call it an object) of Account (and Contact as well) Is there a way to access the ShippingAddress/BillingAddress of the account using the JSON....
3
votes
1answer
2k views

JSON.serialise give output with escape charater

I am doing this: JSON.serialize(payload); where payload is an object instance. and getting this: "{\"signup\":{\"salesforce_id\":\"003110022068XNz\",\"nationbuilder_id\":65536,\"last_name\":\"...