why the input json to create a survey isn't valid json?
I am using JSON5 to generate the JSON in the Visual Editor - http://json5.org/.
This extension is easier to maintain by humans, IMHO.
You may use the standard/valid JSON - it should work as well.
Do you have any issues with this JSON5?
If yes, please describe. I may add the standard JSON generation optionally.
Thank you,
Andrew
I didn't see this issue. There is a PR in the editor repository dealing with this issue https://github.com/andrewtelnov/surveyjs.editor/pull/7
The issue with the current output is simply that it is not valid JSON. In JSON it is mandatory to double-quote the keys. See also: http://json.org/
JSON5 is not a subset of JSON, it is a deviation, and thus not compatible with JSON.
I will add a valid JSON generation as an option.
Added options dropdown button:
http://surveyjs.org/builder/
I will add this functionality to dxsurvey.com later.
Options "Generate Valid JSON" and "Generate Readable JSON" are added.
Updated http://surveyjs.org/builder/ and http://dxsurvey.com
To set them manually use:
var options = {};
options.generateValidJSON = true;
var editor = new SurveyEditor.SurveyEditor("editor", options);
to show options menu in the editor set:
editor.showOptions = true;
I believe the issue is solved.
Thank you,
Andrew
Thank you, that saves us a LOT of time :-)
@andrewtelnov this should really go in the docs or a FAQ or something. Got lucky searching through the issues but I would have been really frustrated and worried as I was initially going to eval() the text output into an object which is very insecure.
@c0bra You are right. We need documentation.
Unfortunately, we are not able to produce a quality docs right now. We will work on them later.
What we can do and actually had to some times ago, create an example and describe all available options. I have added this task to our TODO list.
Thank you,
Andrew
Most helpful comment
Options "Generate Valid JSON" and "Generate Readable JSON" are added.
Updated http://surveyjs.org/builder/ and http://dxsurvey.com
To set them manually use:
var options = {}; options.generateValidJSON = true; var editor = new SurveyEditor.SurveyEditor("editor", options);to show options menu in the editor set:
editor.showOptions = true;I believe the issue is solved.
Thank you,
Andrew