public class hiJSONutl extends Object
| コンストラクタと説明 |
|---|
hiJSONutl() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static String[] |
asStrArray(Object obj_)
オブジェクトからString[]を得る(試験中).
|
static LinkedHashMap<String,Object> |
asStrKeyMap(Object obj_)
Map<String,Object>にキャストする.
|
static void |
objConv(Object obj_,
List<String[]> to_)
文字列の2次元Array-ObjectからArrayList<String[]>を得る(試験中).
|
static void |
objConv(Object obj_,
Map<String,String> to_)
Map<String,String>のObjectからMap<String,String>を得る(試験中).
|
static String |
parseAsString(String json_)
JSON文字列をパーズしてStringを得る
|
static String |
parseAsString(String json_,
long option_)
JSON文字列をパーズしてStringを得る
|
static String[] |
toArray(String json_text_)
JSON文字列を解析し、文字列配列を得る.
|
static LinkedHashMap<String,String[]> |
toArrayDict(String json_text_)
JSON文字列を解析し、文字列配列辞書を得る.
|
static LinkedHashMap<String,String[]> |
toArrayDict(String json_text_,
LinkedHashMap<String,String[]> to_)
JSON文字列を解析し、文字列配列辞書を得る.
|
static LinkedHashMap<String,String[]> |
toArrayDict(String json_text_,
LinkedHashMap<String,String[]> to_,
long option_)
JSON文字列を解析し、文字列配列辞書を得る.
|
static LinkedHashMap<String,String[]> |
toArrayDict(String json_text_,
long option_)
JSON文字列を解析し、文字列配列辞書を得る.
|
static ArrayList<String> |
toList(String json_text_)
JSON文字列を解析し、文字列リストを得る.
|
static ArrayList<String> |
toList(String json_text_,
ArrayList<String> to_)
JSON文字列を解析し、文字列リストを得る.
|
static ArrayList<String> |
toList(String json_text_,
ArrayList<String> to_,
long option_)
JSON文字列を解析し、文字列リストを得る.
|
static LinkedHashMap<String,ArrayList<String>> |
toListDict(String json_text_)
JSON文字列を解析し、文字列リスト辞書を得る.
|
static LinkedHashMap<String,ArrayList<String>> |
toListDict(String json_text_,
LinkedHashMap<String,ArrayList<String>> to_)
JSON文字列を解析し、文字列リスト辞書を得る.
|
static LinkedHashMap<String,ArrayList<String>> |
toListDict(String json_text_,
LinkedHashMap<String,ArrayList<String>> to_,
long option_)
JSON文字列を解析し、文字列リスト辞書を得る.
|
static ArrayList<String[]> |
toMatrix(String json_text_)
JSON文字列を解析し、文字列配列のリストを得る.
|
static ArrayList<String[]> |
toMatrix(String json_text_,
ArrayList<String[]> to_)
JSON文字列を解析し、文字列配列のリストを得る.
|
static ArrayList<String[]> |
toMatrix(String json_text_,
ArrayList<String[]> to_,
long option_)
JSON文字列を解析し、文字列配列のリストを得る.
|
static ArrayList<String[]> |
toMatrix(String json_text_,
long option_)
JSON文字列を解析し、文字列配列のリストを得る.
|
static LinkedHashMap<String,ArrayList<String[]>> |
toMatrixDict(String json_text_)
JSON文字列を解析し、文字列配列のリストの辞書を得る.
|
static LinkedHashMap<String,ArrayList<String[]>> |
toMatrixDict(String json_text_,
LinkedHashMap<String,ArrayList<String[]>> to_)
JSON文字列を解析し、文字列配列のリストの辞書を得る.
|
static LinkedHashMap<String,ArrayList<String[]>> |
toMatrixDict(String json_text_,
LinkedHashMap<String,ArrayList<String[]>> to_,
long option_)
JSON文字列を解析し、文字列配列のリストの辞書を得る.
|
public static String[] asStrArray(Object obj_)
obj_ - パーズ結果のオブジェクトpublic static void objConv(Object obj_, List<String[]> to_)
obj_ - パーズ結果のオブジェクトto_ - 変換結果をここに得るpublic static void objConv(Object obj_, Map<String,String> to_)
Map _a1=(Map)obj_;
for(Object _obj:_a1.entrySet()){
Map.Entry _entry=(Map.Entry)_obj;
to_.put((String)_entry.getKey(),(String)_entry.getValue());
}
obj_ - パーズ結果のオブジェクトto_ - 変換結果をここに得るpublic static LinkedHashMap<String,Object> asStrKeyMap(Object obj_)
static asStrKeyMap(Object obj_){
return (LinkedHashMap<String,Object>)obj_;
}
obj_ - パーズ結果のオブジェクトpublic static String parseAsString(String json_) throws Exception
json_ - JSON文字列Exception - パーズエラー等public static String parseAsString(String json_, long option_) throws Exception
json_ - JSON文字列option_ - オプションException - パーズエラー等public static ArrayList<String[]> toMatrix(String json_text_) throws Exception
JSONの二次元配列形式の文字列からArrayList<String[]>データを
得ます。
通常のjsonと異なり引用符はシングルクオートでもダブルクオートでも
かまいません。コメントも可能です。
解析される文字列の例
"[['A','B','C'],['X','Y','Z']]"
json_text_ - 解析する文字列Exception - パーズエラー等public static ArrayList<String[]> toMatrix(String json_text_, long option_) throws Exception
json_text_ - 解析する文字列option_ - hiJSON.with_option(long)参照参照Exception - パーズエラー等public static ArrayList<String[]> toMatrix(String json_text_, ArrayList<String[]> to_) throws Exception
JSONの二次元配列形式の文字列からArrayList<String[]>データを
得ます。
通常のjsonと異なり引用符はシングルクオートでもダブルクオートでも
かまいません。コメントも可能です。
解析される文字列の例
"[['A','B','C'],['X','Y','Z']]"
json_text_ - 解析する文字列to_ - ここに解析結果を得るException - パーズエラー等public static ArrayList<String[]> toMatrix(String json_text_, ArrayList<String[]> to_, long option_) throws Exception
json_text_ - 解析する文字列to_ - ここに解析結果を得るoption_ - hiJSON.with_option(long)参照Exception - パーズエラー等public static ArrayList<String> toList(String json_text_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
"['A','B','C']"
次の操作と同等です。
@SuppressWarnings("unchecked")
Object _json=parse(json_text_);
ArrayList<String> _to=(ArrayList<String>)_json;
json_text_ - 解析する文字列Exception - パーズエラー等public static String[] toArray(String json_text_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
"['A','B','C']"
json_text_ - 解析する文字列Exception - パーズエラー等public static LinkedHashMap<String,String[]> toArrayDict(String json_text_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列Exception - パーズエラー等public static LinkedHashMap<String,String[]> toArrayDict(String json_text_, long option_) throws Exception
json_text_ - 解析する文字列option_ - hiJSON.with_option(long)参照Exception - パーズエラー等public static LinkedHashMap<String,String[]> toArrayDict(String json_text_, LinkedHashMap<String,String[]> to_, long option_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを
得ます。
option_にhiU.APPENDを指定するとto_に追加するかたちとなります。既に同名の要素がある場合は
置き換えられます。配列の追加ではありません。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列to_ - 結果を入れる辞書option_ - hiU.APPENDを付けるとto_に追加されますException - パーズエラー等public static LinkedHashMap<String,String[]> toArrayDict(String json_text_, LinkedHashMap<String,String[]> to_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列to_ - 結果を入れる辞書Exception - パーズエラー等public static ArrayList<String> toList(String json_text_, ArrayList<String> to_, long option_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
"['A','B','C']"
次の操作と同等です。
@SuppressWarnings("unchecked")
Object _json=hiJSON.parseText(json_text_);
ArrayList<String> _to=(ArrayList<String>)_json;
json_text_ - 解析する文字列to_ - 結果を入れる文字列リストoption_ - hiU.APPENDを付けるとto_に追加されますException - パーズエラー等public static ArrayList<String> toList(String json_text_, ArrayList<String> to_) throws Exception
JSONの1次元配列形式の文字列からArrayList<String>データを 得ます。
解析される文字列の例
"['A','B','C']"
次の操作と同等です。
@SuppressWarnings("unchecked")
Object _json=hiJSON.parseText(json_text_);
ArrayList<String> _to=(ArrayList<String>)_json;
json_text_ - 解析する文字列to_ - 結果を入れる文字列リストException - パーズエラー等public static LinkedHashMap<String,ArrayList<String>> toListDict(String json_text_, LinkedHashMap<String,ArrayList<String>> to_, long option_) throws Exception
JSONの1次元配列形式の文字列からHashMap<String,ArrayList<String>>データを
得ます。
option_にhiU.APPENDを指定するとto_に追加するかたちとなります。既に同名の要素がある場合は
置き換えられます。配列の追加ではありません。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列to_ - 結果を入れる文字列リストoption_ - hiU.APPENDを付けるとto_に要素が追加されます。Exception - パーズエラー等public static LinkedHashMap<String,ArrayList<String>> toListDict(String json_text_, LinkedHashMap<String,ArrayList<String>> to_) throws Exception
JSONの1次元配列形式の文字列からHashMap<String,ArrayList<String>>データを 得ます。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列to_ - 結果を入れる文字列リストException - パーズエラー等public static LinkedHashMap<String,ArrayList<String>> toListDict(String json_text_) throws Exception
JSONの1次元配列形式の文字列からHashMap<String,ArrayList<String>>データを
得ます。
option_にhiU.APPENDを指定するとto_に追加するかたちとなります。既に同名の要素がある場合は
置き換えられます。配列の追加ではありません。
解析される文字列の例
{
"要素名1":['A','B','C'],
"要素名2":['x','y','z']
}
json_text_ - 解析する文字列Exception - パーズエラー等public static LinkedHashMap<String,ArrayList<String[]>> toMatrixDict(String json_text_) throws Exception
JSONの二次元配列形式の文字列からArrayList<String[]>の辞書を
得ます。
拡張jsonであり引用符はシングルクオートでもダブルクオートでも
かまいません。要素名は引用符で囲む必要はありません。コメントも可能です。
String json="{'elm1':[['A','B','C'],['X','Y','Z']]"
+"// コメント\n"
+",\"elm2\":[['a','b',\"x\"],['x',/*コメント*/'y','x'],['あ','い']]}"
HashMap<String,ArrayList<String[]>> data
=hiText.jsonToMatrixDict(json);
json_text_ - 解析する文字列Exception - パーズエラー等public static LinkedHashMap<String,ArrayList<String[]>> toMatrixDict(String json_text_, LinkedHashMap<String,ArrayList<String[]>> to_, long option_) throws Exception
JSONの二次元配列形式の文字列からArrayList<String[]>の辞書を
得ます。
option_引数にhiU.APPENDを指定するとto_辞書に辞書要素を追加する形となります。
to_辞書に既に既に同名の要素がある場合は置き換えられます。
拡張jsonであり引用符はシングルクオートでもダブルクオートでも
かまいません。要素名は引用符で囲む必要はありません。コメントも可能です。
String json="{'elm1':[['A','B','C'],['X','Y','Z']]"
+"// コメント\n"
+",\"elm2\":[['a','b',\"x\"],['x',/*コメント*/'y','x'],['あ','い']]}"
HashMap<String,ArrayList<String[]>> data
=hiText.jsonToMatrixDict(json);
json_text_ - 解析する文字列to_ - 結果を入れる辞書option_ - hiU.APPENDを付けるとto_に追加されます。Exception - パーズエラー等public static LinkedHashMap<String,ArrayList<String[]>> toMatrixDict(String json_text_, LinkedHashMap<String,ArrayList<String[]>> to_) throws Exception
JSONの二次元配列形式の文字列からArrayList<String[]>の辞書を
得ます。
拡張jsonであり引用符はシングルクオートでもダブルクオートでも
かまいません。要素名は引用符で囲む必要はありません。コメントも可能です。
String json="{'elm1':[['A','B','C'],['X','Y','Z']]"
+"// コメント\n"
+",\"elm2\":[['a','b',\"x\"],['x',/*コメント*/'y','x'],['あ','い']]}"
HashMap<String,ArrayList<String[]>> data
=hiText.jsonToMatrixDict(json);
json_text_ - 解析する文字列to_ - 結果を入れる辞書Exception - パーズエラー等