- What's the difference between JSON and JavaScript object notation?
- JSON (JavaScript Object Notation) is a strict subset of JavaScript's object literal syntax. Key differences: JSON requires double quotes for keys and strings, doesn't allow trailing commas, doesn't support comments, and cannot contain functions or undefined values. JavaScript object notation is more flexible and can include these features.
- Can I convert JavaScript objects with functions or undefined values to JSON?
- No. JSON cannot represent functions, undefined values, or Symbol types. When converting JavaScript objects containing these, they will be omitted (functions/undefined) or converted to null (Symbol). For functions, you'll need to stringify them separately or use a custom serializer.
- How does the converter handle circular references?
- Standard JSON.stringify throws an error for circular references. This tool detects circular references and either throws an error or uses a replacer function to handle them. For complex objects with circular references, you'll need to manually break the cycle or use specialized libraries like JSON.stringify with a custom replacer.
- What happens to dates when converting JavaScript to JSON?
- Date objects are automatically converted to ISO 8601 strings (e.g., "2023-12-25T10:30:00.000Z") during JSON conversion. When parsing JSON back, dates remain as strings unless you manually parse them. To preserve Date objects, you can use a reviver function in JSON.parse() to detect and convert date strings.
- Is my data safe when converting with this tool?
- Yes. All conversion happens entirely in your browser using client-side JavaScript. Your data never leaves your device or gets uploaded to any server. All processing occurs locally in your browser memory, and data is discarded when you close the page, making it safe for sensitive information.