下記は、testjsonという文字列にJSON形式のデータが入っているという前提です。
最終的にJSONStringに変換してその値を取り出しています。なんかまどろっこしいですよね。
なお***.gwt.xml ファイルには
< inherits name='com.google.gwt.json.JSON' />の記述が必要です。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String testjson="{\"userID\":\"ochi\",\"userPW\":\"ochilab\"}"; | |
JSONObject jsObj; | |
JSONValue jsonValue = JSONParser.parse(testjson); | |
jsObj = jsonValue.isObject(); | |
JSONString st = jsObj.get("userPW").isString(); | |
Window.alert(st.stringValue()); |
0 件のコメント:
コメントを投稿