We are about to switch to a new forum software. Until then we have removed the registration on this forum.
JSONObject json;
println("hello web!");
json = loadJSONObject ("URL_HERE");
println (json);
Hello all
Above is my code to get the JSONObject from the URL. This code works in Java mode, but in JavaScript mode, it only print 'Hello web!' and stopped.
Where did I wrong?
Thank you very much
Answers
http://processingjs.org/reference/
I also tried the following code:
Basically, it comes from this example:
http://processingjs.org/reference/loadStrings_/
But the code only can prints "Hello 2", then stopped.
Could you give me a hint? Thank you very much.
I've already given ya a hint: ProcessingJS's site! 8-}
JS Mode is still far behind Java Mode version 2+! (~~)
If you look at JS's reference, you won't find any JSON there! [..]
I don't think "google.com" is a complete URL either! /:)
Generally, we should only load from "/data/" subfolder in JS Mode! :-S
Could you give me a sample URL? I changed loadJSONObject to loadStrings but it still does not work :(
Two issues here:
And indeed, you would need a full URL with http:// schema.
So, the only thing you can do is to loadStrings() from your own site.
I see
So is there anyway to load a text from other site in JS, and parse as a JSON?
I still don't know how all that works. But I guess we gotta request the local server itself to load a remote file
and place it locally, so it's available for our local app scripts!
Or take a look at JsonP.