-
Notifications
You must be signed in to change notification settings - Fork 6.5k
JSONPath_Extract
温绍锦 edited this page Oct 1, 2018
·
2 revisions
1.2.51之后,fastjon提供了根据JSONPath快速解析JSON的API,避免原来需要先解析完再做JSONPath处理,能显著提升性能。
package com.alibaba.fastjson;
public class JSONPath {
public static Object extract(String json, String path);
}
final String json = "[\n" +
" {\n" +
" \"name\" : \"john\",\n" +
" \"gender\" : \"male\"\n" +
" },\n" +
" {\n" +
" \"name\" : \"ben\"\n" +
" }\n" +
"]";
String result = JSONPath.extract(json, "$[0]['name','gender']").toString();
assertEquals("[\"john\",\"male\"]", result);
如有需要修改本注脚,请联系阿里巴巴,
© Alibaba Fastjson Develop Team
注明: 版权所有阿里巴巴,请注明版权所有者
If you need to amend this footnote, please contact Alibaba.
© Alibaba Fastjson Develop Team
Note: Copyright Alibaba, please indicate the copyright owner