Thread overview
[Issue 3415] New: JSON output does not pass validation
[Issue 3415] broken JSON output
Oct 26, 2009
Ary Borenszweig
Apr 14, 2010
Rainer Schuetze
May 06, 2010
Don
October 17, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3415

           Summary: JSON output does not pass validation
           Product: D
           Version: 1.050
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: brian-schott@cox.net


--- Comment #0 from brian-schott@cox.net 2009-10-17 15:16:41 PDT ---
Items in arrays output by the -X option of dmd are not properly separated by commas. The most common example of this is class member functions.

Example:

...
"members" : [
{
"name" : "drawLayer",
"kind" : "function",
"type" : "void(uint layer, int x, int y)",
"line" : 133}
{
"name" : "drawAllLayers",
"kind" : "function",
"type" : "void(int x, int y)",
"line" : 149}
...

Should read:

...
"members" : [
{
"name" : "drawLayer",
"kind" : "function",
"type" : "void(uint layer, int x, int y)",
"line" : 133},
{
"name" : "drawAllLayers",
"kind" : "function",
"type" : "void(int x, int y)",
"line" : 149},
...

The lack of commas causes the resulting files to fail validation and attempts at parsing. See: http://www.jsonlint.com/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 26, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Ary Borenszweig <ary@esperanto.org.ar> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |echochamber@gmail.com


--- Comment #1 from Ary Borenszweig <ary@esperanto.org.ar> 2009-10-26 01:01:09 PDT ---
*** Issue 3440 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #2 from Rainer Schuetze <r.sagitario@gmx.de> 2010-04-14 00:04:47 PDT ---
This happens for declarations in an AttribDeclaration, where the code for adding commas is missing. Here's the patch:

Index: json.c ===================================================================
--- json.c    (revision 432)
+++ json.c    (working copy)
@@ -214,11 +214,17 @@

     if (d)
     {
+        size_t offset = buf->offset;
         for (unsigned i = 0; i < d->dim; i++)
         {   Dsymbol *s = (Dsymbol *)d->data[i];
+            if (offset != buf->offset)
+            {   buf->writestring(",\n");
+                offset = buf->offset;
+            }
             //printf("AttribDeclaration::toJsonBuffer %s\n", s->toChars());
             s->toJsonBuffer(buf);
         }
+        JsonRemoveComma(buf);
     }
 }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-05-05 19:06:53 PDT ---
Fixed DMD2.044

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------