Hello,

Json js-encoder generats incorrect json, which could not be parsed by drupal because of extra ",".
Also it ignored arrays hence arguments could not be passed to views.

This seems to work:

Drupal.toJson = function(v) {
switch (typeof v) {
case 'boolean':
return v == true ? 'TRUE' : 'FALSE';
case 'number':
return v;
case 'string':
return '"'+ v +'"';
case 'object':
var buffer = []
if (v instanceof Array) {
for(var i=0; i buffer.push(Drupal.toJson(v[i]))
}
return "["+buffer.join(",")+"]"
} else {
for(var i in v) {
buffer.push(i+":"+Drupal.toJson(v[i]))
}
return "{"+buffer.join(",")+"}"
}
default:
return 'null';
}
};

Comments

dmitrig01’s picture

Status: Active » Fixed

Fixed in the 1.0 version!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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