A JSON object is delineated by { and }. Currently (alpha 2), Views JSON doesn't wrap the JSON object in curly brackets. It's a simple fix and I've attached a patch that does it.

Further, hard-coding "nodes" as the name of the JSON object is a bit inappropriate as Views 2 supports comments, files, node revisions, terms and users. IMHO the object name should reflect the type of view that generated it.

I also noticed that the module doesn't follow the Drupal coding standards very strictly. It's a minor issue and understandable given it's an alpha.

Comments

pereljon’s picture

Any fix for the drupal 5 version?
Is this module still maintained or is there another active module for exporting data through a view??

thanks!

pereljon’s picture

StatusFileSize
new1.62 KB

Ok... here's my first ever attempt at a Drupal code patch (first ever code submit to Drupal... yey!)...
It fixes several issues with the delineation of the main JSON object (which was missing the curly braces).
It also fixes trailing commas in the last field of a node and in the last node of the JSON object.
Hope it works...
(Patch is for 5.x-1.0-alpha2)

allisterbeharry’s picture

Thanks for the patches; don't know how I missed that. Will be fixed in next releases.

allisterbeharry’s picture

Status: Active » Fixed
allisterbeharry’s picture

Assigned: Unassigned » allisterbeharry

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.