We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fastjson 1.2.0之后的版本支持JSONPath。
package com.alibaba.fastjson; public class JSONPath { // 构造函数 public JSONPath(String path) {} // 求值方法 public Object eval(Object rootObject) { } }
建议缓存JSONPath对象,这样能够提高求值的性能。
public void test_entity() throws Exception { Entity entity = new Entity(); entity.setValue(new Object()); Assert.assertSame(entity.getValue(), new JSONPath("$.value").eval(entity)); } public static class Entity { private Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } }