jthurst01 / apex-library Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/apex-library
Automatically exported from code.google.com/p/apex-library
What steps will reproduce the problem?
1. When Json object has to parse large amount of json response, due to
salesforce governance limits it will throw "Too many scripts error".
What is the expected output? What do you see instead?
I am expecting Json object to parse my json response but due to too many
loopings to parse the data I am getting error.
What version of the product are you using? On what operating system?
SalesSforce, Apex
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 3 Apr 2012 at 7:22
What steps will reproduce the problem?
This should fail, but does not:
1. System.assertEquals('}', new JSONObject().ValueToString());
What is the expected output? What do you see instead?
new JSONObject().ValueToString() should return "{}", not "}"
Please provide any additional information below.
Because ValueToString appends trailing commas to all values, it removes the
last comma in its return statement:
ret.substring(0,ret.length()-1) + '}'
This, of course, is buggy if no values were appended.
Fixes are:
a. add a trailing space to the "ret" initializer:
string ret = '{ '; // note trailing space
or
b. abandon the substring call (which is performant in java but not
necessarily other languages - unsure of how Apex handles it) and instead
append leading commas for all values except the first..
public String valueToString() {
string ret = '{';
for ( string key: this.keys() ) {
if (ret.size() > 1) ret += ',';
ret += '"' + key + '": ' + this.getvalue(key).valueToString();
}
return ret + '}';
}
Original issue reported on code.google.com by [email protected]
on 24 May 2010 at 1:33
The leading JSON Parser from Douglas Crockford
(http://www.json.org/json2.js) and www.JSONLint.com apparently don't like
the LValue keys to be without quotes.
Example: {foo: "bar"} should be {"foo": "bar"}
JSONObject.valueToString() doesn't emit quotes around keys. I've updated
this method as follows to appease various JSON parsers...
public String valueToString() {
string ret = '{';
for ( string key: this.keys() ) {
ret += '"' + key + '": ' +
this.getvalue(key).valueToString() + ',';
}
return ret.substring(0,ret.length()-1) + '}';
}
Original issue reported on code.google.com by [email protected]
on 26 Mar 2010 at 1:21
Attempting to parse an escaped double quote in a double quoted string gave an
error:
08:56:58.427|FATAL_ERROR|superpat.JSONObject.JSONException: Expected a , or }
Class.superpat.JSONObject.<init>: line 201, column 23
Class.superpat.JSONObject.JSONTokener.nextValue: line 1303, column 35
Class.superpat.JSONObject.<init>: line 186, column 25
Class.superpat.JSONObject.<init>: line 219, column 6
Class.superpat.SimpleGeo.getContextFromAddress: line 32, column 16
AnonymousBlock.superpat: line 3, column 22
The problem was in parsing
{"latitude":37.793755,"longitude":-122.395584,"address":"\"1 Market St, San
Francisco, CA\""}
Looking at the code, it looks like this was on the 'to do list' :-) I fixed
enough to get my code working, but I couldn't figure out the Apex for
sb.append((char)Integer.parseInt(next(4), 16));
to handle \u and \x :-/
Patch attached.
Original issue reported on code.google.com by [email protected]
on 24 Jan 2011 at 5:04
Attachments:
Hi
This parser works fine with Google APIs. I am trying to use elance API to
search for the jobs and it throws me an exception "Expected a , or }". The JSON
response of elance and Google looks different.
Would I have to modify this class so that it work with elance API?
Thanks
Original issue reported on code.google.com by [email protected]
on 18 Apr 2011 at 7:23
project new JSON
Original issue reported on code.google.com by [email protected]
on 5 Feb 2012 at 9:20
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.