JSON Minifier Pro






Related Pages: JSON Formatter.

About JSON Minifier Pro:

This pro online json minifier tool helps you to minify raw JSON string to save space to transmit faster cross Internet.

More information about JSON (JavaScript Object Notation):

RFC 8259 (JSON): https://tools.ietf.org/html/rfc8259

Python Implementation of JSON: https://docs.python.org/3/library/json.html

Java Implementation of JSON (GSON): https://github.com/google/gson

JSON Minifier with Python (with build-in package JSON):

import json


def minify_json(str):
    resultStr = json.dumps(json.loads(str), ensure_ascii=False)
    return resultStr
    

JSON Minifier with Java (with build-in package GSON):

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;


public String minify(String jsonStr){
    JsonParser parser=new JsonParser();
    JsonElement je=parser.parse(jsonStr);
    Gson gson=new GsonBuilder().serializeNulls().create();
    return gson.toJson(je);
}