New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'EOF' #238
Comments
I think the code you try to load contains some weird character, the error you print there says that it sees an EOF (end of file) character. |
Yea but why? I cannot find the Problem nor a Sollution for it. i am using
and this seems like the latest version |
I see I had a typo in my previous comment, ment to say I expect there is an invalid character in the string you try to load. |
Well I tried to load a Constant string:
and not even that is working. It throws the exception at the set function. |
ah, you pass a string instead of a JSON object. You can do either one of the following: editor.setText("[{\"test\":\"test\"}]");
var json = JSON.parse("[{\"test\":\"test\"}]");
editor.set(json); here an example: |
I still don't get it exactly, your code should still work and not throw an error: just load your text as a string containing this JSON. |
I even tried to switch from my Local version to the CDN one. Same error |
Ok i found, somehow the error. Its the Options object. After calling the Constructor without it, it shows property. This is no solution for me because i must be aware of the change event, but now it shows the Editor. Edit: var JsonEditOptions = { is working fine for me. edit 2: "modes": [ |
Can you create a jsbin demonstrating the issue? I don't know how to reproduce it. |
The exact code: |
I found the issue: in your change: function () {
if (editor != null) {
var contents = editor.get(); // ooops, editor.get() can throw an Exception
}
} This method |
No thats not the problem, try comment it out and it still not working. http://jsbin.com/pimivufibu/1/edit?html,output After its works i found that problem and fixed it with: this.SelectedItem.Content = angular.fromJson(editor.get()); this was right after my change to the working code: |
? your jsbin works indeed fine without the change listener (except for a ReferenceError as I updated my jsbin, it throws exactly your original exception: http://jsbin.com/gekohi/edit?html,output. When you comment the change listener out, the problem is fixed. |
In mode code and text, you will have to give the DIV container where you put the JSONEditor a height. |
Jes i saw that just a sec ago ... |
hey,
I tried to set the JSON to the Editor and got the error you can see in the header:
Error: Parse error on line 1:
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'EOF'
The string i tried to push is:
[{"test":"test"}]
Both methods set, setText produces this error
any help?
The text was updated successfully, but these errors were encountered: