All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.fastjson2.support.airlift.JSONFunctions Maven / Gradle / Ivy

There is a newer version: 2.0.53
Show newest version
package com.alibaba.fastjson2.support.airlift;

import com.alibaba.fastjson2.JSONPath;
import com.alibaba.fastjson2.JSONReader;
import io.airlift.slice.Slice;

public class JSONFunctions {
    public static Slice jsonExtract(Slice json, JSONPath path) {
        byte[] bytes = json.byteArray();
        int off = json.byteArrayOffset();
        int length = json.length();
        JSONReader jsonReader = JSONReader.of(bytes, off, length);
        SliceValueConsumer sliceValueConsumer = new SliceValueConsumer();
        path.extract(jsonReader, sliceValueConsumer);
        return sliceValueConsumer.slice;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy