Skip to content
Advertisement

Tag: json

Chrome sendrequest error: TypeError: Converting circular structure to JSON

I’ve got the following… which calls the following.. However, my code never reaches “ZOMG HERE” but rather throws the following error while running chrome.extension.sendRequest Does anyone have any idea what is causing this? Answer It means that the object you pass in the request (I guess it is pagedoc) has a circular reference, something like: JSON.stringify cannot convert structures like

What is JSONP, and why was it created?

I understand JSON, but not JSONP. Wikipedia’s document on JSON is (was) the top search result for JSONP. It says this: JSONP or “JSON with padding” is a JSON extension wherein a prefix is specified as an input argument of the call itself. Huh? What call? That doesn’t make any sense to me. JSON is a data format. There’s no

JSON: why are forward slashes escaped?

The reason for this “escapes” me. JSON escapes the forward slash, so a hash {a: “a/b/c”} is serialized as {“a”:”a/b/c”} instead of {“a”:”a/b/c”}. Why? Answer JSON doesn’t require you to do that, it allows you to do that. It also allows you to use “u0061” for “A”, but it’s not required, like Harold L points out: The JSON spec says

JSON Stringify changes time of date because of UTC

My date objects in JavaScript are always represented by UTC +2 because of where I am located. Hence like this Problem is doing a JSON.stringify converts the above date to What I need is for the date and time to be honoured but it’s not, hence it should be Basically I use this: I tried passing a replacer parameter (second

Merge keys array and values array into an object in JavaScript

I have: And I’d like to convert it into this object: In Python, there’s the simple idiom dict(zip(keys,values)). Is there something similar in jQuery or plain JavaScript, or do I have to do this the long way? Answer Simple JS function would be: Of course you could also actually implement functions like zip, etc as JS supports higher order types

Advertisement