javascript - D3.js and Drupal - SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data -
this strange ... use drupal , drupal view outputs json file. if access file directly embedded javascript error: syntaxerror: json.parse: unexpected character @ line 1 column 1 of json data however, if copy file output drupal view passes json validation , if paste file produced javascript there no error , script executes correctly. here generated json data:
{"nodes":[{"node":{"body":"this short story","category":"heatwave","latitude":43.6689985,"longitude":-79.3155716,"link":"http://crewtoronto.ca/entityform/1"}},{"node":{"body":"this short description of effect of ice storm on our household","category":"ice storm","latitude":43.6689985,"longitude":-79.3155716,"link":"http://crewtoronto.ca/entityform/2"}},{"node":{"body":"the ice storm affected large tree in our backyard. several large limbs broke off covering third of yard. have cleaned up, managing ourselves save money. did not have power 2 days. lost bit of food.","category":"ice storm","latitude":43.6920105,"longitude":-79.3027845,"link":"http://crewtoronto.ca/entityform/6"}}]}
any idea wrong?
i found out caused problem. in case has same problem views api setting in drupal view. here says setting: "not using view api mode means json gets output directly , server ceases normal page processing. using means server not cease processing after outputting json. allows views api used view without having prematurely terminate page processing." had being using views api.
Comments
Post a Comment