Is d3.json() function can get json object?

d3.js, jquery

Solution

If you have the data as a Javascript variable, you don't need the `d3.json` function. Simply use the name of the variable where ever you would use the argument to the second parameter (the callback function) to `d3.json`.

var data = [1,2,3];   
svg.selectAll("circle")
.data(data)
.enter()
.append("circle")
.‌​attr("cx", function(d) { return d; })
.attr("cy", function(d) { return d; })

Problem

I am new to JQuery / d3js world. I would like to draw a chart from data in json format. I saw i some samples that `d3.json(json,f)` function can get only file with data in json format. My question: is it possible to call it with json like object or string in json format,for example: ``` val jsonStr = { "foo" : "bar"} d3.json(jsonStr ,f) ``` If not how can I draw a chart with dynamic data (in json format)

Original source