https://augustpinch.com/qnd7d2fhd?key=ed5dbed8ecdd9af92e2b54e652945382
8
Thursday, April 24, 2025
JSON FORMATTER TOOL
Here's a simple JSON formatter tool code in JavaScript:
```
function formatJson(jsonString) {
try {
const jsonObject = JSON.parse(jsonString);
return JSON.stringify(jsonObject, null, 2);
} catch (error) {
return "Invalid JSON";
}
}
// Example usage:
const jsonString = '{"name":"John","age":30,"city":"New York"}';
const formattedJson = formatJson(jsonString);
console.log(formattedJson);
```
This code:
1. Parses the input JSON string into a JavaScript object
2. Stringifies the object with indentation (2 spaces) for formatting
Subscribe to:
Post Comments (Atom)
WORD AND CHARACTER COUNTER TOOL
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="view...
-
Domain IP Checker Domain IP Checker Enter a domain name: Check IP
-
Fast.com Web View
-
Privacy Policy Generator Privacy Policy Generator Generate Privac...
No comments:
Post a Comment