FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
JSON Formatter: Prettify, Validate, and Lint JSON Like a Pro
NewsProgramming Languages

JSON Formatter: Prettify, Validate, and Lint JSON Like a Pro

via Dev.to Pythonarenasbob2024-cell1mo ago

JSON formatting is one of those things you do ten times a day but rarely think about. Here's everything you need to know. JSON.stringify: The Basics const data = { name : " Alice " , roles : [ " admin " , " editor " ] }; // Minified (default) JSON . stringify ( data ) // '{"name":"Alice","roles":["admin","editor"]}' // Pretty-printed (2-space indent) JSON . stringify ( data , null , 2 ) // { // "name": "Alice", // "roles": [ // "admin", // "editor" // ] // } // Tab indent JSON . stringify ( data , null , ' \t ' ) The Replacer Function (Secret Power) // Filter sensitive fields JSON . stringify ( data , ( key , value ) => { if ( key === ' password ' || key === ' token ' ) return undefined ; return value ; }, 2 ); // Or pick specific keys JSON . stringify ( data , [ ' name ' , ' email ' ], 2 ); Command Line: jq jq is the JSON Swiss Army knife: # Pretty-print cat data.json | jq '.' # Minify cat data.json | jq -c '.' # Sort keys cat data.json | jq -S '.' # Extract fields cat data.json | jq

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
10 views

Related Articles

Core Web Vitals for eCommerce in 2026: Why Your Shopify Theme Might Be Killing Conversions
News

Core Web Vitals for eCommerce in 2026: Why Your Shopify Theme Might Be Killing Conversions

Medium Programming • 1w ago

Bose's flagship headphones just dropped to the lowest price I've seen on Amazon
News

Bose's flagship headphones just dropped to the lowest price I've seen on Amazon

ZDNet • 1w ago

News

RefundYourSOL (RYS): Unlocking the Full Potential of Your Solana Assets

Medium Programming • 1w ago

Lego Star Wars Smart Play Throne Room Duel and A-Wing Review
News

Lego Star Wars Smart Play Throne Room Duel and A-Wing Review

Wired • 1w ago

I found the best tech deals under $50 during Amazon's Big Spring Sale
News

I found the best tech deals under $50 during Amazon's Big Spring Sale

ZDNet • 1w ago

Discover More Articles