Status

()

Core
DOM
RESOLVED WORKSFORME
10 years ago
10 months ago

People

(Reporter: Pierre, Assigned: Robert Sayre)

Tracking

1.9.0 Branch
x86
Windows XP
Points:
---
Bug Flags:
wanted1.9.0.x +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

10 years ago
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

10 years ago
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
(Assignee)

Updated

10 years ago
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Assignee)

Updated

10 years ago
Assignee: nobody → sayrer
Status: ASSIGNED → NEW
(Reporter)

Comment 1

10 years ago
It works with:

var Obj = {};
Obj.propertie1 = "value1";
Obj.propertie2 = "value2";

OR

var Obj = {"propertie1": "value1", "propertie2": "value2"};
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 3

10 years ago
ug, I lost track of this. we'll get it asap.
Flags: wanted1.9.0.x?
(Assignee)

Comment 4

10 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

10 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...
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)
Created attachment 327538 [details]
Object encoded by json2.
Created attachment 327539 [details]
Object encoded by nativeJSON.
Flags: wanted1.9.0.x? → wanted1.9.0.x+

Comment 9

9 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.
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

9 years ago
yeah, this is fixed there.

Comment 12

10 months ago
Closing per earlier comments.
Status: ASSIGNED → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.