Skip to content
No description, website, or topics provided.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
README.md
pom.xml

README.md

JSON ABNFで RFC 8259 JSONとRFC 6901 JSON Pointer、RFC 6902 JSON Patchを実装してみたもの

// JavaScript からの例 // オブジェクトを文字列に変換する JavaScript:JSON.stringify(obj) Java;JSON.stringify(obj) Java:JSONValue.valueOf(obj).toString();

// 文字列をオブジェクトに変換する JavaScript:JSON.parse(src) Java:JSON.parseToObj(src,class); Java:JSON8259Reg.parse(src)

おぶじぇくとまっぴんぐ各種 --- String to JSONValue to String---

String str = "{ abc: def }"; JSONValue value = JSON8259Reg.parse(str); String str = value.toString();

String str = "文字列"; JSONString value = JSONValue.valueOf(str); Boolean, Number系も同じ。 str = value.value();

List list = new ArrayList(); (略) JSONArray array = JSONValue.valueOf(list); list = array.value(); list = array.map(List.class);

String[] stringArray = {略}; JSONArray array = JSONValue.valueOf(stringArray); stringArray = array.map(はいれつのくらす);

int[] abc = {1,2,3}; JSONArray array = JSONValue.valueOf(abc); abc = array.map(int[]のくらす); abc = array.toArray(new int[0]); // も可 new

object は publicなデータを持つおぶじぇくと class A { int[] b; String c; List d; }

A object; JSONObject obj = JSONValue.valueOf(object); JSONArray numVal = (JSONArray)obj.get("b"); object = obj.map(A.class);

Map map = new HashMap(); JSONObject obj = JSONValue.valueOf(map); map = obj.map(Map.class);

You can’t perform that action at this time.