ãªããã®çµã¿åãããã¨ããã¨ãJSONObjectã使ãã¨ãã«ã¨ã©ã¼ãåºãããã§ãã
twitter4jã®ä½¿ãæ¹ã¯こちらの記事ãè¦ã¦ãã ããã
twitter4jã®ã©ã¤ãã©ãªãã¹ã±ãããã©ã«ãã«ã¤ã³ã¹ãã¼ã«ããå¾ã§ã次ã®ãããªProcessingã¹ã±ãããæ¸ãã¦ã¿ã¾ãããã
import twitter4j.conf.*; import twitter4j.internal.async.*; import twitter4j.internal.org.json.*; import twitter4j.internal.logging.*; import twitter4j.http.*; import twitter4j.internal.util.*; import twitter4j.api.*; import twitter4j.util.*; import twitter4j.internal.http.*; import twitter4j.*; void setup() { size(300, 300); JSONObject json = loadJSONObject("test.json"); String x = json.getString("x"); String y = json.getString("y"); println("x = " + x); println("y = " + y); } void draw() { }
é常ã«ç°¡åãªã³ã¼ãã§ããtwitter4jã®ã©ã¤ãã©ãªãèªãã§ãã以å¤ã¯ãåç´ã« setup ã®ä¸ã§ "test.json" ãèªãã§ããã ãã§ãã
ãã¡ãããã¹ã±ããã¨åããã©ã«ãå
ã«æ¬¡ã®ãã㪠"test.json" ãç½®ãã¦ããã¾ãã
{ "x": "2", "y": "123" }
ããã¨æ¬¡ã®ãããªã¨ã©ã¼ãåºãã§ãããã
The type JSONObject is ambiguous
"ambiguous = ããã¾ã" ã§ããããè¤æ°ã®JSONObjectããã£ã¦ã©ã¡ããå¤æãä»ããªãã¨ãããã¨ã§ãããã
ããããããã¯ãtwitter4j 2.2.5 ã®ã©ã¤ãã©ãªå
ã§ã JSONObject ã宣è¨ããã¦ãã¦ãProcessing 2.0 ã®ãã®ã¨ã©ã¡ããå¤æãã¤ããªãã®ã ã¨æãã¾ãã
ãã®è¨¼æ ã«ãimportæããã¹ã¦åé¤ããã¨ãä½ã®ã¨ã©ã¼ããªãå®è¡ããã¾ãã
ãããã£ã¦ãFQDNã§Processing 2.0 ã®JSONObjectãæå®ããªããã°ãªãã¾ããã
ãProcessing 2.0 JSONObejctãã§Googleæ¤ç´¢ããã¨ã次ã®ã¯ã©ã¹ãªãã¡ã¬ã³ã¹ãåºã¦ãã¾ãã
ããã°ã£ã¦æ¢ãã¨ãJSONObjectã®FQDNã¯ã
processing.data.JSONObject
ã ã¨ãããã¨ããããã¾ãã®ã§ããã®ããã«ã½ã¼ã¹ã³ã¼ããä¿®æ£ãã¾ãã
åèï¼ Class JSONObject
å
·ä½çã«ã¯ã次ã®éãã§ãã
import twitter4j.conf.*; import twitter4j.internal.async.*; import twitter4j.internal.org.json.*; import twitter4j.internal.logging.*; import twitter4j.http.*; import twitter4j.internal.util.*; import twitter4j.api.*; import twitter4j.util.*; import twitter4j.internal.http.*; import twitter4j.*; void setup() { size(300, 300); processing.data.JSONObject json = loadJSONObject("test.json"); String x = json.getString("x"); String y = json.getString("y"); println("x = " + x); println("y = " + y); } void draw() { }
ã§ã¯ããã®è¾ºã§ã