1
0

【JavaScript】オブジェクトをJSON文字列に変換する方法

Posted at

JSON.stringify()を使用することでオブジェクトや値をJSON文字列に変換します。

const jsonObject = {
    name: "Sample",
    age: 20
}
const jsonString = JSON.stringify(jsonObject)

console.log(jsonString) // {"name": "Sample","age": 20}

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0