Hello all,
I'm using jsoneditor for a while and I'm thankful for that tool.
For a while (I think ca. 6-9 months?), I've stored a JSON document online. Now, I'm trying to open it. Following error message I've get:
SyntaxError: Unexpected token h in JSON at position 0
And the left panel (JSON code) contains only the link:
https://jsoneditoronline.org/?id=123456
123456 is of course changed.
Is there a limit for storage time? What goes wrong?
Thank you.
I can have a look. Can you email me the exact id of your document?
Hello,
thank you for taking time for me.
I have found out the issue. But I think it will be interesting for you.
The problem is the link that I've used. If I use this one:聽http://www.jsoneditoronline.org/?id=123456 (especially http://www.json....), the behavior is like described.
The editor contains in that case a little bit changed link:聽https://jsoneditoronline.org/?id=123456 (https://json...)
If I use the link聽https://jsoneditoronline.org/?id=123456, I get my data.
My problem is solved now. I'll use the other link.
I'm interested for behavior explanation if you will do that. Thank you.
Regards,
Niko
Good to hear you ave access to your document again.
Links with "www" should automatically redirect to the non-www url of the website - ie. http://www.jsoneditoronline.org should redirect your to http://jsoneditoronline.org. This works properly when I try it (using Chrome), apparently not at your browser? Or do you mean the difference between http and https?
The link in the editor I've get because of auto-saving data in cookies. I think I've accidentally added the link in an empty editor and get it stored in cookies.
I'm using up-to-date Chrome (and tested now with other installed browser):
The redirection works fine, but the id of the document will be not "reused". If I request a document with an id and use www in the link, I'll be redirected to start page of jsoneditor.
After I've deleted the cookies on Chrome, all three browser have same behavior:
| Prefix | |
| --- | --- |
| http://www | start page with example data |
| https://www | start page with example data |
| http:// | my data |
| https:// | my data |
Is this behavior ok? Would it not be better to redirect from http://www.json....org/id=12345 to http://json....org/id=12345?
PS: I'll remove the id in previous post after your next answer
Is this behavior ok? Would it not be better to redirect from http://www.json....org/id=12345 to http://json....org/id=12345?
well, the idea basically is that there should be no www in the url. I've created a simple static redirect page for convenience in case people accidentally enter it like that, and indeed the id is not send along.
If it would make things simpler I could simply remove this redirection page so you get a "page not found" instead or something like that?
The cleanest solution - in my view - is to redirect with id transfer; something like that:
<meta http-equiv="refresh" content="0; url=http://jsoneditoronline.org/<?php
if (isset($_GET["id"])) {
echo "?id=$_GET['id']";
}
?>">
I thinks its hard to display 'page not found'. The solutions are conflicting:
But it is only my point of view and I don't know how much effort it will get to implement the 'dynamic' redirection. The most amount of people using the website would not pinch here I think. Its on your side to decide.
Thank you for giving fast support. For people managing several websites and having family its not self-evident.
Thank you for giving fast support. For people managing several websites and having family its not self-evident.
Thanks, well, to be honest it's a struggle sometimes for me :)
I agree that it would be neat to auto-redirect with the id passed in the url. However the website is a static website so I would have to (a) migrate the website so I can do such backend-tricks, or (b) implement it in JavaScript code in which case it wouldn't be a real redirect, which will make things even more complicated.
I agree that it's not a good thing that the www url "sort of sometimes" works. A quick change I will do is change the timeout of the www redirect to say 5 seconds, so people can actually read the message that the www url is not the correct url and it's more clear that it's really just a redirect for convenience.
I've updated the page with redirection now, it explains the www thing and redirects after 10 seconds.
I've just tried it. I think it's a good solution.
Blessings for the future work :)