JSON.stringify doesn't directly work with sets because the data stored in the set is not stored as properties.

But you can convert the set to an array. Then you will be able to stringify it properly.

Any of the following will do the trick:

JSON.stringify([...s]);
JSON.stringify([...s.keys()]);
JSON.stringify([...s.values()]);
JSON.stringify(Array.from(s));
JSON.stringify(Array.from(s.keys()));
JSON.stringify(Array.from(s.values()));
Answer from Oriol on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › JSON › stringify
JSON.stringify() - JavaScript | MDN
The JSON.stringify() static method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.
🌐
W3Schools
w3schools.com › js › js_json_stringify.asp
JSON.stringify()
JSON.stringify() can not only convert objects and arrays into JSON strings, it can convert any JavaScript value into a string.
🌐
JSON Formatter
jsonformatter.org › json-stringify-online
JSON Stringify Online using JSON.Stringify()
JSON Stringify Online is very unique tool for convert JOSN to String and allows to download, save, share and print JSON to TSV data..
🌐
JSONLint
jsonlint.com › json-stringify
JSON Stringify - Escape JSON for Embedding | JSONLint | JSONLint
JSON Stringify converts a JSON object into an escaped string. The result can be safely embedded inside another string—in code, databases, or even nested within other JSON.
🌐
ServiceNow Community
servicenow.com › community › developer-blog › servicenow-things-to-know-77-json-stringify-or-stringify-object › ba-p › 2783663
ServiceNow Things to Know 77: JSON.stringify() or ... - ServiceNow Community
January 8, 2024 - Explanation:- Creates a string from a JSON object. The JSON.stringify() method can only convert numbers, strings, and Java native objects to strings. It cannot convert user-defined objects to strings, unless those objects provide a toJSON() method. JSON.stringify() converts a value to JSON notat...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-json-stringify-method
JavaScript JSON stringify() Method - GeeksforGeeks
July 11, 2025 - The JSON.stringify() method in JavaScript is used to convert JavaScript objects into a JSON string.
🌐
Online String Tools
onlinestringtools.com › json-stringify-string
JSON Stringify a String – Online String Tools
This tool converts a string to a JSON string. This is done by calling JSON.stringify() function on the input string. This function adds double quotes at the beginning and end of the input string and escapes special JSON characters.
Find elsewhere
🌐
Online Tools
onlinetools.com › json › stringify-json
Stringify JSON – Online JSON Tools
We call the JSON.stringify() function on the input data and it converts line breaks into "\n" escape sequences, quotes into "\"" escape sequences, and tabs into "\t" escape sequences.
🌐
V8
v8.dev › blog › json-stringify
How we made JSON.stringify more than twice as fast · V8
August 4, 2025 - At the end, the final result is constructed by simply concatenating the output from the initial one-byte stringifier with the output from the two-byte one. This strategy ensures we stay on a highly-optimized path for the common case, while the transition to handling two-byte characters is lightweight and efficient. Any string in JavaScript can contain characters that require escaping when serializing to JSON (e.g.
🌐
W3Schools
w3schools.com › Jsref › jsref_stringify.asp
W3Schools.com
The JSON.stringify() method converts JavaScript objects into strings.
🌐
RestfulAPI
restfulapi.net › home › json › json stringify()
JSON stringify()
November 3, 2023 - The JSON.stringify() function, as name suggests, converts a JavaScript value to a serialized JSON string. JSON.stringify() can optionally use a replacer function to replace values using custom logic.
🌐
Execute Program
executeprogram.com › courses › modern-javascript › lessons › json-stringify-and-parse
JSON Stringify and Parse Lesson
Learn programming languages like TypeScript, Python, JavaScript, SQL, and regular expressions. Interactive with real code examples.
🌐
Reddit
reddit.com › r/learnpython › is there a python equivivalent of javascript's json.stringify() ?
r/learnpython on Reddit: Is there a Python equivivalent of JavaScript's JSON.stringify() ?
January 12, 2017 -

Long story short, is I have a wrapper over an API that pulls in a JSON from a rest call. I use json.loads() to return the response in my Python wrapper. I then use the response to make a REST call using POST method.

My problem is that I'm getting true, false, and none values converted to True, False, and None. When I make my second REST call I need them to be in the form of 'true', 'false, and 'none'. Basically, I want to preserve my string, float, and integers while converted these other types to strings.

Any ideas?

🌐
freeCodeCamp
freecodecamp.org › news › json-stringify-example-how-to-parse-a-json-object-with-javascript
JSON Stringify Example – How to Parse a JSON Object with JS
August 2, 2024 - And just like that, you've parsed incoming JSON with fetch and used JSON.stringify() to convert a JS object literal into a JSON string.
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-json-parse-stringify
How To Use JSON.parse() and JSON.stringify() | DigitalOcean
November 24, 2021 - JSON.stringify() takes a JavaScript object and transforms it into a JSON string.
🌐
npm
npmjs.com › package › fast-json-stringify
fast-json-stringify - npm
February 6, 2026 - Stringify your JSON at max speed. Latest version: 6.4.0, last published: 15 hours ago. Start using fast-json-stringify in your project by running `npm i fast-json-stringify`. There are 212 other projects in the npm registry using fast-json-stringify.
      » npm install fast-json-stringify
    
Published   May 05, 2026
Version   6.4.0
🌐
ServiceNow Community
servicenow.com › community › developer-articles › json-stringify-making-json-look-pretty-and-perfect › ta-p › 2534944
JSON.stringify() - Making JSON Look Pretty and Per... - ServiceNow Community
December 9, 2025 - Well, let's say you're working on a project and you need to update a worknote or comment on a string field. It can get pretty confusing when you're trying to read through all that jumbled up text. But with JSON.stringify(), you can make that messy JSON look clean and organized, making it much easier to understand.