docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합

이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영.

- Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들
  (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거.
- Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/
  Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/
  Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이
  존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존).
- Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/
  JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동.
- 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리.
- Topic_Programming 최종 문서 수: 2784 → 3985.
This commit is contained in:
Antigravity Agent
2026-07-05 00:39:13 +09:00
parent 9148c358d0
commit e9cbf23ab5
1356 changed files with 0 additions and 12831 deletions
@@ -0,0 +1,137 @@
---
id: json-stringify
title: "JSON Stringify"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["JSON.stringify", "JSON stringify", "object to JSON", "serialize JSON", "stringify object"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.9
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["javascript", "js", "web", "frontend", "w3schools", "json", "stringify"]
raw_sources: ["https://www.w3schools.com/js/js_json_stringify.asp"]
applied_in: []
github_commit: ""
---
# [[JSON Stringify]]
## 🎯 한 줄 통찰 (One-line insight)
When sending data to a web server the data has to be a string; `JSON.stringify()` converts any JavaScript datatype into a JSON-notation string — converting dates to strings and removing functions, since JSON allows neither. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Sending data needs a string** — when sending data to a web server, the data has to be a string; convert any JavaScript datatype with `JSON.stringify()`. [S1]
- **Works on objects and arrays** — the result is a string following JSON notation, ready to be sent to a server. [S1]
- **Text storage** — text is always a legal storage format; combined with `localStorage`, JSON lets you store and reload JavaScript objects. [S1]
- **Dates become strings** — in JSON, date objects are not allowed; `JSON.stringify()` converts any Date objects into strings (convert back at the receiver). [S1]
- **Functions are removed** — in JSON, functions are not allowed as object values; `JSON.stringify()` removes any functions (both the key and the value). [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Serialize-then-send** — `JSON.stringify(obj)` produces a transmittable string. [S1]
- **Round-trip storage** — `JSON.stringify` to save in `localStorage`, `JSON.parse` to read it back. [S1]
- **Pre-stringify a function to keep it** — call `obj.fn = obj.fn.toString()` before stringifying so the function survives as a string. [S1]
## 📖 세부 내용 (Details)
A common use of JSON is to exchange data to/from a web server. When sending data to a web server, the data has to be a string. You can convert any JavaScript datatype into a string with `JSON.stringify()`. [S1]
**Stringify a JavaScript object**
```javascript
const obj = {name: "John", age: 30, city: "New York"};
const myJSON = JSON.stringify(obj);
```
The result will be a string following the JSON notation. `myJSON` is now a string, and ready to be sent to a server. [S1]
**Stringify a JavaScript array**
```javascript
const arr = ["John", "Peter", "Sally", "Jane"];
const myJSON = JSON.stringify(arr);
```
The result will be a string following the JSON notation. `myJSON` is now a string, and ready to be sent to a server. [S1]
**Storing data**
When storing data, the data has to be a certain format, and regardless of where you choose to store it, text is always one of the legal formats. JSON makes it possible to store JavaScript objects as text. Example storing and retrieving data in local storage: [S1]
```javascript
const myObj = {name: "John", age: 31, city: "New York"};
const myJSON = JSON.stringify(myObj);
localStorage.setItem("testJSON", myJSON);
let text = localStorage.getItem("testJSON");
let obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
```
**Stringify a number** [S1]
```javascript
const num = 123e-5;
const myJSON = JSON.stringify(num);
```
**Stringify a boolean** [S1]
```javascript
let bool = new Boolean(1);
const myJSON = JSON.stringify(bool);
```
**Stringify a date**
In JSON, date objects are not allowed. The `JSON.stringify()` function will convert any Date objects into strings. [S1]
```javascript
const obj = {name: "John", today: new Date(), city : "New York"};
const myJSON = JSON.stringify(obj);
```
You can convert the string back into a date object at the receiver. [S1]
**Stringify a function**
In JSON, functions are not allowed as object values. The `JSON.stringify()` function will remove any functions from a JavaScript object, both the key and the value. [S1]
```javascript
const obj = {name: "John", age: function () {return 30;}, city: "New York"};
const myJSON = JSON.stringify(obj);
```
You can preserve a function by converting it to a string before stringifying: [S1]
```javascript
const obj = {name: "John", age: function () {return 30;}, city: "New York"};
obj.age = obj.age.toString();
const myJSON = JSON.stringify(obj);
```
If you send functions using JSON, the functions will lose their scope, and the receiver would have to use `eval()` to convert them back into functions. [S1]
## 🛠️ 적용 사례 (Applied in summary)
Applied examples on the page: serialize an object and an array for sending to a server; round-trip an object through `localStorage`; stringify numbers, booleans, dates, and functions, including the `.toString()` trick to keep a function. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Serialize an object to send to a server:
```javascript
const obj = {name: "John", age: 30, city: "New York"};
const myJSON = JSON.stringify(obj);
```
Round-trip an object through local storage:
```javascript
const myJSON = JSON.stringify(myObj);
localStorage.setItem("testJSON", myJSON);
let obj = JSON.parse(localStorage.getItem("testJSON"));
```
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.90
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[JavaScript Tutorial]]
- **관련 개념:** [[JavaScript JSON Parse]], [[JavaScript JSON]], [[JavaScript JSON Data Types]], [[JavaScript JSON Objects]]
- **참조 맥락:** Referenced whenever serializing JavaScript data for transmission to a server or storage.
## 📚 출처 (Sources)
- [S1] W3Schools — JSON Stringify — https://www.w3schools.com/js/js_json_stringify.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JSON Stringify" page (Astra wiki-curation, P-Reinforce v3.1 format).