Closed
Bug 426718
Opened 17 years ago
Closed 8 years ago
JSON too much comma
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: pvacher, Assigned: sayrer)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
Hello
I find a JSON bug in FF3 beta4 and beta5...
Method JSON.encode put a comma to the end of the last object propertie.
Thank
Pierre
Reproducible: Always
Steps to Reproduce:
var kJSONContractID = "@mozilla.org/dom/json;1";
var kJSONSVCIID = Components.interfaces.nsIJSON;
var JSON = Components.classes[kJSONContractID].getService(kJSONSVCIID);
var Obj = {propertie1: "value1", propertie2: "value2"};
var jsonStr = JSON.encode(Obj);
dump(jsonStr);
Actual Results:
{"propertie1":"value1","propertie2":"value2",}
Expected Results:
{"propertie1":"value1","propertie2":"value2"}
Updated•17 years ago
|
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
Assignee | ||
Updated•17 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Updated•17 years ago
|
Assignee: nobody → sayrer
Status: ASSIGNED → NEW
It works with:
var Obj = {};
Obj.propertie1 = "value1";
Obj.propertie2 = "value2";
OR
var Obj = {"propertie1": "value1", "propertie2": "value2"};
Comment 2•17 years ago
|
||
This _might_ be the issue I'm seeing writing some of the new automation code. The simplejson parser for Python is barfing on JSON output from the native Mozilla JSON parser. I had to use the json2.js parser from crockford instead.
Assignee | ||
Comment 4•17 years ago
|
||
I can't reproduce this on trunk. Can anyone get it in Firefox 3?
I will still add a test case for this, to prevent future occurrences.
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•17 years ago
|
||
(In reply to comment #2)
> This _might_ be the issue I'm seeing writing some of the new automation code.
> The simplejson parser for Python is barfing on JSON output from the native
> Mozilla JSON parser. I had to use the json2.js parser from crockford instead.
>
You should attach the input here...
Comment 6•17 years ago
|
||
I'm attaching two files, one is the JSON returned from json2.js , the other is the JSON returned by the native encoder which when I try to parse it with simplejson I get the following error;
ValueError: Expecting property name: line 1 column 23451 (char 23451)
Comment 7•17 years ago
|
||
Comment 8•17 years ago
|
||
Updated•17 years ago
|
Flags: wanted1.9.0.x? → wanted1.9.0.x+
Comment 9•16 years ago
|
||
I just hit this bug too. I exported my bookmarks from FF 3.0.11 and they had the extra comma that made the Python simplejson parser barf.
Comment 10•16 years ago
|
||
This is fixed in trunk and 1.9.1, due to the new ES5 JSON codec (I hope)? I'm optimistically setting the Version field to reflect a "yes" answer.
/be
Version: Trunk → 1.9.0 Branch
Assignee | ||
Comment 11•16 years ago
|
||
yeah, this is fixed there.
Comment 12•8 years ago
|
||
Closing per earlier comments.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•