inzapp / treemap-json

JSON with custom comparator using treemap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Treemap JSON

JSON with custom comparator using treemap
You can sort json by json key

Download

https://github.com/inzapp/treemap-json/releases

Usage

JSONObject json = new JSONObject(new Comparator<String>() {
    @Override
    public int compare(String a, String b) {
        // parameter a, b is json key
        // just implement your comparator
        return a.compareTo(b);
    }
});

Using lambda expression

json = new JSONObject((Comparator<String>) (a, b) -> {
    return a.compareTo(b);
});

About

JSON with custom comparator using treemap

License:MIT License


Languages

Language:Java 100.0%