mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-06-25 05:41:45 +00:00
Webassembly 기본
This commit is contained in:
16
wasm/www/index.js
Normal file
16
wasm/www/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
import * as jsonpath from "rs-jsonpath";
|
||||
|
||||
let jsonString = "{\"a\" : 1}";
|
||||
|
||||
let template = jsonpath.compile("$.a");
|
||||
console.log(template(jsonString));
|
||||
console.log(template(JSON.parse(jsonString)));
|
||||
|
||||
let reader1 = jsonpath.reader(jsonString);
|
||||
console.log(reader1("$.a"));
|
||||
|
||||
let reader2 = jsonpath.reader(JSON.parse(jsonString));
|
||||
console.log(reader2("$.a"));
|
||||
|
||||
console.log(jsonpath.read(JSON.parse(jsonString), "$.a"));
|
||||
console.log(jsonpath.read(jsonString, "$.a"));
|
Reference in New Issue
Block a user