javascript - Jekyll ruining JSON file. Arrows ("=>") instead of ":" -
i wanted make chopleth d3.js in jekyll draft.
but somehow jekyll changing json file from
{"type":"featurecollection", "features":[{"type":"feature", "id":"01",
to
{"type"=>"featurecollection", "features"=>[{"type"=>"feature", "id"=>"01",
i wanted jekyll put json file inside d3.json() function, this:
d3.json({{site.data.us-states}}, function(json){ svg.selectall("path") blah blah
where us-states us-states.json file heckin jekyll putting everywhere =>
is able me?
site
jekyll global variable.
site.data
ruby hash containing data loaded yaml files located in _data
directory.
site.data.us-states
ruby hash or array, assume.
d3.json
d3 function fetches json. not convert ruby hash or array javascript object.
in ruby, convert hash or array json calling to_json
on it.
in javascript, convert json string object calling json.parse
.
Comments
Post a Comment