JSON, or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs. It is used primarily to transmit data between a server and web application, as an alternative to XML.

learn more… | top users | synonyms

0
votes
1answer
45 views

How to Using JSON with visualforce

I'm new on visualforce and JSON, and I have a page that have many inputFields want to insert them by clicking on save, and get them back on click on edit button for example, I searched on google for ...
0
votes
1answer
45 views

possible ways to insert multiple values of the same field

I have an Object with RecordNum, RecordVal, And User__id as a reference .. and a VF page as the following <apex:pageBlock> <apex:inputField value="{!Object.RecordVal}" label="val 1:" ...
2
votes
2answers
29 views

How to retrieve just the text without formatting from a rich text field using JSON?

I am querying a rich text field that contains text information using a public rest service using this method ...
2
votes
2answers
44 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 ...
3
votes
2answers
88 views

My custom REST endpoint is returning double encoded JSON. How can I make it stop?

Here is my current controller: @RestResource(urlMapping='/monitor') global with sharing class TheController { @HttpGet global static String doGet() { Map<String, Object> ...
0
votes
1answer
43 views

How to get Json response without rest api and parse the response in objects

I need to get json response and parse the response into the object(Without using http callout).I need to have application(class) which can get response from other callback url and parse that response ...
5
votes
2answers
141 views

JSON.serialize is mucking with my datetime objects. How do I fix this?

I feel that the following assertion should be true, but it is not: DateTime testDate = DateTime.now(); System.assertEquals('"' + testDate.format('yyyy-MM-dd\'T\'hh:mm:ss.SSS\'Z\'' + '"'), ...
2
votes
2answers
64 views

Apex Rest JSON serialization Error: Invalid type for Http* method: …Map.Object

Background I'm developing some generics apex web service (Rest). The response should be an standardised json schema like this: { "res": true, "message": "Records Upserted Ok", "data" : ...
2
votes
1answer
44 views

How do I test cover simple JSON creation in a trigger?

I have an contact after trigger which collects data from Contact, add some personal, authentication pairs, and updates a 3rd party system. While the insertion of account/contact in the test class is ...
4
votes
2answers
445 views

How to properly use JQuery Datatable sAjaxSource with Apex providing JSON source

I'm trying to use sAjaxSource with server side processing from Apex class which will provide JSON as source. First I was trying simple example, which won't work and won't output any error (not in ...
2
votes
1answer
90 views

Transform JSON with lists inside into form data in Apex

Is it possible to serialize this JSON to Form-data in Apex? The JSON we received: [{"vendorcode":"4444","startDate":"2014-03-02","client":[{"name":"John"}]}] We need to serialize it to Form-Data, ...
5
votes
1answer
187 views

How to JSON.serialize an opportunities line items?

How can I JSON.serialize an opportunities line items? I need to create a single json file, that holds an oppty as well as it's line items. If I just JSON.serialize(opportunity), I get all the ...
0
votes
2answers
54 views

How to update an Account field value from an External Service after a future call

I am integrating Salesforce with an external ERP system. The create/update of accounts in SF, requires that I update/create them in the external system, and also keep the External's ID, within my ...
5
votes
1answer
205 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 ...
1
vote
1answer
58 views

Getting signed request inside an Apex class

How do i get a signed request field inside of an Apex class ? I mean in .Net I can get it like this: string signedRequest = Request.Params["signed_request"]; Is there a similar "Request" object ...
4
votes
3answers
603 views

JSON and escaped double quote

I'm currently making a callout to a 3rd party vendor and I'm getting a huge response. What is currently messing me up is this section: "MessageSeq":13,"Description":"config file: ...
0
votes
1answer
96 views

Using JSON to parse Rally rest api service results

How do i use JSON to parse out the following result i get back from Rally's web service api. {"QueryResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [], "Warnings": ["It is no longer ...
1
vote
2answers
106 views

Editing a Static Resource via Apex with Metadata API

I have recently found a way to create a Static Resource via the Metadata API - see this article. So, I was curious if it was possible to not only create a static resource, but to either: Edit the ...
0
votes
2answers
125 views

deserialize the JSON string and also how can I save into account object

I retrieve the records from Account object and display JSON format in Visualforce page. How can I deserialize the JSON and store the result in Account object. my Visualforce < apex:page ...
3
votes
1answer
141 views

parse JSON into Object

I am trying to parse the following JSON format into a Object. { "info1": "blah blah", "info2": "blah blah2", "info3": 1391673663, "info4": "blah4", "info5": { "AAA": 0.1, "BBB": ...
2
votes
0answers
43 views

Streaming API notification payload

My SF account (PE with API) doesn't return the "sobject" fields in streaming API notification that it should. I'v tested with a free developer account, and it works fine there. I create a push topic ...
5
votes
3answers
567 views

Deserialising a JSON response [duplicate]

I am trying to deserialize a JSON response. public class CLiveExMarketPriceHistory{ public String lwin11; //11227502005 public String lcurrency; //GBP public String priceFrom; //2013-07-12 ...
9
votes
2answers
247 views

What are the different capabilities between the @RemoteAction serializer and JSON.serialize?

I've been working quite a bit with @RemoteAction methods and have noticed there seem to be a few inconsistencies between what's allowed in the apex JSON.(de)serialize methods and what the automatic ...
2
votes
1answer
56 views

JSON.serialise give output with escape charater

I am doing this: JSON.serialize(payload); where payload is an object instance. and getting this: ...
3
votes
1answer
146 views

Unable to deserialize json data accessed from salesforce object in asp.net

I need to access data records from salesforce object. I got the json response.The json document is given below, { "totalSize":2, "done":true, "records": [{"attributes": { ...
1
vote
2answers
116 views

Apex - Displaying a nested list after deserialising json

I would like to make a http callout to import json and display the information in a visualforce page. The problem I'm having is that the json is nested and so I need to loop through the child nodes. ...
3
votes
1answer
89 views

json deserialize error

I'm getting frustrated with an "Unknown field" error when I invoke deserializeStrict. Simple application, all strings... My apex class contains this public class: public class CustomerInfo{ ...
2
votes
1answer
394 views

Method does not exist or incorrect signature: [Id].contains(String)?

Error Error: Autocompletefields Compile Error: Method does not exist or incorrect signature: [Id].contains(String) at line 20 column 21 public class Autocompletefields { public ...
2
votes
1answer
158 views

Is there a JSON Schema available for the Analytics REST API?

Is there a JSON Schema (or similar) available for the Anaylytics REST API? I'm looking to generate strongly typed code for parsing the JSON responses. Usually I'd go with SOAP and WSDL based code ...
3
votes
1answer
283 views

JSONParser error - System.JSONException: Unexpected character ('r' (code 114))

Im trying to parse the following JSON from a web service callout, however im getting the above error on this line: while(parser.nextToken() != null) Is it to do with the '\' in the json?? if so how ...
4
votes
1answer
107 views

Exclude properties from Apex class when serializing to JSON

Is it possible to delete class properties dynamically in Apex Example: public class BananaHolder() { public boolean isRipe; public boolean isDelicious; public integer ...
3
votes
1answer
146 views

Regex a datetime from JSON and convert to miliseconds

I've JSON like this: "to" : "2013-11-28T20:58:00.000+0000", Which I want to make into: "to" : "/Date(1296547200000)/", The furthest I got with regex is replaceAll('(?m)(?i)"from" : "(.+?)("$)', ...
1
vote
0answers
128 views

JSON from nested query

I've got this query: SELECT name, (SELECT From__c, To__c FROM Trip__r) FROM Account limit 1 [ { "attributes" : { "type" : "Account", "url" : ...
5
votes
2answers
645 views

How to store and JSON-serialize Map of Objects AND SObjects

This question is an extension to Write a generic JSON-serializable Parameters class without hitting “Apex Type unsupported in JSON: Object” where I learned how to serialize a Map to and from JSON. My ...
3
votes
2answers
142 views

Prevent sorted list losing sort order after JSON.serialization

I have a controller method which returns a list to VF page in a sorted order. After sorting I am serializing the list to send to VF. However JSON.serialization which destroys the order of the list. ...
3
votes
1answer
201 views

how to return a parent and its children records in JSON query

I am using SOQL to query Salesforce via the Mobile SDK SFResRequest method. I want to know is it possible to create an efficient query that will return a set of parent records and their associated ...
4
votes
2answers
159 views

JSON.deserialize is not working as expected

I am passing a json string to this class. Then I try this: Account jsonRes = (Account) JSON.deserialize(jsonString, Account.class); I get this error: Error: Compile Error: Method does not ...
10
votes
3answers
306 views

Unit tests that need more than one WebServiceMock

I'm dealing with an odd situation where I need to call Webservice A to authenticate to Webservice B and Webservice C, all with different endpoints. I know how to setup mocks to test B and C ...
0
votes
2answers
532 views

How to iterate nested dictionaries to return object values

I need code (example) to show how can I iterate a JSON return array of dictionaries that contains nested dictionaries as a result of a join query. For example I get the following returned (ignore ...
7
votes
1answer
327 views

APEX ENUM Serialize to and Deserialize from JSON

I have APEX classes defined with enum properties that are to be serialized into JSON. Also, I am reading in JSON and deserializing them back to my defined classes. To make the enum properties work ...
2
votes
1answer
116 views

How to do a DML upsert/insert loop in custom object after JSON deserialization?

I'm fairly new to Apex and I am completely at a loss at what to do next. So far I was able to grab and deserialize my JSON I grabbed from a Web Service(This does a GET Method for info for ...
1
vote
3answers
690 views

Invalid conversion from runtime type LIST<ANY> to MAP<String,ANY>

I'm trying to make a webcall to pull data from an external webservice. After that call I would like to insert my data that comes in the form of JSON into my custom object called Company. However I am ...
6
votes
1answer
143 views

Is there a way to get the SOQL behind a report?

I have a (reasonably) Year on Year analysis summary report that I use in Salesforce and I would like to create this report in SOQL or at least create the SOQL equivelant to return the same results, ...
2
votes
1answer
162 views

how to retrieve more than 2000 records returned from the rest api in Salesforce Mobile Native iOS SDK

I am currently unable to load more than 2000 records from a SOQL query via the Native iOS Salesforce Mobile SDK. Is there a way of returning all the records in the query? I see that the JSON response ...
7
votes
1answer
504 views

How do I use Type.forName to deserialize a generic list of SObjects?

When the new Apex type methods were added in Summer '12, it was possible to do Type t = Type.forName('MyClass'); MyClass newObj = (MyClass)t.newInstance(); What is the equivalent when I want to ...
2
votes
1answer
563 views

How to serialize an object as JSON?

I have an object that's pretty extensive (lots of properties and child relationships). I'd like to serialize it. So I am doing the following: Proposal__c proposal = (Proposal__c) getRecord(); ...
2
votes
3answers
461 views

Serialize Unprintable Unicode Characters

I'm having a problem with unprintable unicode characters breaking a Visualforce page. The problem is that some of my data contains the unicode character 8232 (\u2028 - LINE SEPARATOR), which it ...
4
votes
3answers
299 views

JSON generator not adding comma between objects?

For some strange reason when i try to use the JSON generator to generate some basic JSON using a specific format its not putting a comma between two objects.. here is a simplified example of what im ...
10
votes
1answer
270 views

Bug? Why doesn't JSON.serialize support DescribeSObjectResult?

JSON.serialize supports DescribeFieldResult, meaning that I can do this: return JSON.serialize(Account.Name.getDescribe()); However, when I try to serialize the SObject itself, I experience an ...
2
votes
0answers
267 views

JSON.Serialize method not returning null fields (part deux)

My question is related to the question JSON.Serialize method not returning null fields in that I'm having the same issue but based on the solution, I'm unable to get my code to use version 27 (maybe ...