JSON को मिनिफ़ाई कैसे करें
मुख्य बातें
- पेस्ट करें
- मिनिफ़ाई करें
- कॉपी करें
JSON you've formatted for reading sometimes needs to be packed back, to cut data volume or handle it on one line. "Make one line" in Format and Validate JSON removes spaces and line breaks.
चरण
- Paste the JSON into "Before".
- Press "Make one line".
- The one-line JSON appears under "After".
- Copy with "Copy result" and use it.
Only spaces and line breaks vanish. The data's contents don't change.
Benefits of one line
- File and communication sizes get smaller
- It can be passed to other systems as one line of data
- Easy to put in logs and environment variables
- Easy to pass as an argument on the command line
When to format and when to compress
- Format: when people read or edit it
- Make one line: when handing to machines or storing
Cautions
- One-line JSON is hard for people to read. Keeping the formatted original is handy.
- Spaces and line breaks inside strings remain as they are.
How much smaller
The more spaces and line breaks, the bigger the effect. Deeply indented JSON can shrink by 20–30%.
इनके लिए अच्छा
- Building the body of an API request
- Putting settings into an environment variable
- Outputting JSON on one line in logs
- Saving to a database field
उदाहरण
Wanted to put formatted configuration JSON into an environment variable. Pasted it, pressed "Make one line", then copied the result and set it.
Common stumbling blocks
- An error appears: there is a mistake in the JSON syntax. Check before formatting.
- Japanese characters change: this tool leaves Japanese as it is.
- Want to go back: pressing "Format" indents it again.
Frequently asked questions
Can one-line JSON be turned back into readable form?
Yes. Pressing "Format" indents it.
सारांश
One line for machines, formatted for people. Keep the original JSON too.
“JSON फ़ॉर्मैट और वैलिडेट करें” इस्तेमाल करें (मुफ़्त)इसके साथ काम आने वाले टूल
- CSV और JSON बदलें: CSV और JSON के बीच तुरंत बदलें।
- फ़ाइलें और Base64 बदलें: फ़ाइलों और Base64 टेक्स्ट के बीच बदलें।
- दोहराई पंक्तियाँ हटाएँ और सूची को क्रम में लगाएँ: दोहराई गई पंक्तियाँ हटाएँ और उन्हें क्रम में लगाएँ।
अगर यह गाइड काम आया हो, तो एक छोटी टिप हमारे लिए बहुत मायने रखेगी।
टिप भेजें (¥300)उपहार भेजें (Amazon विशलिस्ट)