JSON is derived from JavaScrtipt (JavaScript Object Notation) and is just the format using key value pairs. Values can be booleans, strings, numbers, arrays or objects. That's all it is. Answer from Jayoval on reddit.com
🌐
Reddit
reddit.com › r/learnjavascript › can someone please explain json to me?
r/learnjavascript on Reddit: Can someone please explain JSON to me?
November 24, 2023 -

I've never worked with any DB or back-end, etc stuff, but I am in need of some sort of data storage. I'm working on a javascript application that will only be run on my pc, offline, and I need to be able to save information. I don't want to rely on localStorage because if the browser history is wiped then all the data goes with it.

While searching for a way to collect and store info, I read about JSON, and it sounded like what I was looking for--and yet I've spent the last 4 hours watching tutorials and so far all I know about it is it's fching JS. I sat through a 12 minute video where all the guy did was write out an object in json and then copy and paste into a js file and said "now you know how to use json in all your future projects" 🙄 like what in ACTUAL fk. You could have just WROTE that in js. What's the point of JSON? Everything I've seen or read is practically just the same as this video.

DOES json collect and store data?

Like, if I put an input form in my app, and type a name and hit submit, can I make that Input hardcode into the json file to be saved forevermore and called upon when I needed in this app? Because that's what I need. Any explanation or help on this would be GREATLY appreciated.

🌐
W3Schools
w3schools.com › whatis › whatis_json.asp
What is JSON
The JSON syntax is derived from JavaScript object notation syntax, but the JSON format is text only. Code for reading and generating JSON data can be written in any programming language.
Discussions

How to check if a string is a valid JSON string?
EDIT: The new version of json2.js makes a more advanced parsing than above, but still based on a regexp replace ( from the comment of @Mrchief ) ... This is only checking if the code is safe for eval to use. For example the following string '2011-6-27' would pass that test. More on stackoverflow.com
🌐 stackoverflow.com
Can comments be used in JSON? - Stack Overflow
Perhaps you might reconsider your "well-defined JSON is your opinion" view after reading ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf It is a real standard and devs implementing their own "special" versions leads to fragmentation, confusion and a lot of wasted time. Look at the mess web developers are left with when writing code ... More on stackoverflow.com
🌐 stackoverflow.com
xml - Is JSON a language, if not how would it be classified? - Stack Overflow
Considering JSON (JavaScript Object Notation), is JSON itself a language, or is it only defined in context of another language? By language, I mean a programming language that might be using JSON to More on stackoverflow.com
🌐 stackoverflow.com
Is nested JSON the same as dot-path in VS Code settings.json?
I could be wrong but dot-path is preferable as Intellisense depends on that structure according to the schema stores. More on reddit.com
🌐 r/vscode
1
1
October 5, 2019
JSON is derived from JavaScrtipt (JavaScript Object Notation) and is just the format using key value pairs. Values can be booleans, strings, numbers, arrays or objects. That's all it is. Answer from Jayoval on reddit.com
🌐
JSON
json.org
JSON
JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.
🌐
JSONLint
jsonlint.com
JSONLint - The JSON Validator
Programming can be challenging, as it requires enormous attention and excellent knowledge of the programming language, even as simple as JSON. Still, writing code is tricky, and finding an error in JSON code can be a challenging and time-consuming task.
🌐
Wikipedia
en.wikipedia.org › wiki › JSON
JSON - Wikipedia
March 6, 2005 - JSON was based on a subset of the JavaScript scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999) and is commonly used with JavaScript, but it is a language-independent data format.
Top answer
1 of 16
1402

Here's a function that uses JSON.parse to return a bool indicating whether the JSON string can be successfully parsed:

function isJsonString(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

Here's a similar function that will either return the parsed object, or null if it couldn't be parsed.

function parse_json(json_string)
{
    let json_object = null;
    
    try
    {
        json_object = JSON.parse(json_string);
    }
    
    catch (e)
    {
        return null;
    }
    
    return json_object;
}
2 of 16
614

I know i'm 3 years late to this question, but I felt like chiming in.

While Gumbo's solution works great, it doesn't handle a few cases where no exception is raised for JSON.parse({something that isn't JSON})

I also prefer to return the parsed JSON at the same time, so the calling code doesn't have to call JSON.parse(jsonString) a second time.

This seems to work well for my needs:

/**
 * If you don't care about primitives and only objects then this function
 * is for you, otherwise look elsewhere.
 * This function will return `false` for any valid json primitive.
 * EG, 'true' -> false
 *     '123' -> false
 *     'null' -> false
 *     '"I'm a string"' -> false
 */
function tryParseJSONObject (jsonString){
    try {
        var o = JSON.parse(jsonString);

        // Handle non-exception-throwing cases:
        // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
        // but... JSON.parse(null) returns null, and typeof null === "object", 
        // so we must check for that, too. Thankfully, null is falsey, so this suffices:
        if (o && typeof o === "object") {
            return o;
        }
    }
    catch (e) { }

    return false;
};
Find elsewhere
🌐
Oracle
oracle.com › ai database
What is JSON?
April 4, 2024 - JSON is neither a file nor a code. Instead, it’s a simple format used to store and transport data. It is a plain-text format, which allows for easy data interchange between different programming languages.
🌐
Codecademy
codecademy.com › article › what-is-json
What Is JSON? | Codecademy
Fortunately for us, there exists such a data-exchange format. JSON, or JavaScript Object Notation, is a popular, language-independent, standard format for storing and exchanging data.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Scripting › JSON
Working with JSON - Learn web development | MDN
JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or ...
🌐
W3Schools
w3schools.com › js › js_json.asp
W3Schools.com
The JSON format is syntactically identical to the code for creating JavaScript objects.
🌐
Spiceworks
spiceworks.com › spiceworks inc › soft-tech › json types, functions, and uses with examples - spiceworks inc
JSON Types, Functions, and Uses with Examples
December 16, 2025 - Working, Uses, Pipelines, and Features · JSON format has a syntax nearly identical to the code for JavaScript objects. This similarity makes it very easy for programs written in JavaScript to be converted to a JSON data format.
🌐
JSON Checker
jsonchecker.com
JSON Checker - The Best JSON Validator and automatic formatter
JSON is an acronym for JavaScript Object Notation. It was originally discovered in the early 2000s by Douglas Crockford, one of the architects of JavaScript. JSON is composed of two data structures: An ordered list expressed using "[]" (square ...
🌐
Code Institute
codeinstitute.net › blog › coding › what is json? a guide
What is JSON? Definitions & Examples - Code Institute Global
October 20, 2022 - JSON (JavaScript Object Notation) is a data format designed to be easily readable by people and computers. This guide tells you more.
🌐
Squarespace
developers.squarespace.com › what-is-json
What is JSON? — Squarespace Developers
JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.
🌐
Amazon Web Services
aws.amazon.com › databases › amazon documentdb › what is json
What is JSON? - JSON Explained - AWS
2 days ago - JavaScript Object Notation, more commonly known by the acronym JSON, is an open data interchange format that is both human and machine-readable.
🌐
MongoDB
mongodb.com › resources › languages › what-is-json
What Is JSON? | A Beginner’s Guide | MongoDB
Otherwise, they are equivalent. It’s also easy to convert JS objects to JSON using the stringify() method and vice versa using the parse() method. JS is the abbreviation for JavaScript and not JSON.
🌐
Hostinger
hostinger.com › home › tutorials › what is json: understanding syntax, storing json data and downloadable cheat sheet
What Is JSON? Syntax, Examples + Cheat Sheet
September 9, 2025 - JSON is a simple and lightweight alternative to Extensive Markup Language (XML), which has become less common as a data interchange format. This is because converting XML to a JavaScript object takes tens to hundreds of lines of code and requires further customization based on the specific element being parsed.
🌐
Medium
medium.com › @catherineisonline › what-is-json-ba631eeb0f32
What is JSON?
November 10, 2023 - What it does is that it runs the data as a script which makes data avoid the cross-origin restriction due to the fact that script tags are not restricted by cross-origin policy. Usual JSON code uses a so-called “XMLHttpRequest” object when requesting files from another domain while JSONP uses a script containing a function call.