2023-01-21

A few examples of JSON (JavaScript Object Notation) messages

Here are a few examples of JSON messages:

  1. A simple JSON object representing a person’s name and age:

{
“name”: “John Smith”,
“age”: 30
}

  1. A JSON object representing a collection of books:

{
“books”: [
{
“title”: “The Great Gatsby”,
“author”: “F. Scott Fitzgerald”,
“year”: 1925
},
{
“title”: “To Kill a Mockingbird”,
“author”: “Harper Lee”,
“year”: 1960
},
{
“title”: “The Catcher in the Rye”,
“author”: “J.D. Salinger”,
“year”: 1951
}
]
}

  1. A JSON object representing a message with metadata and data payload:

{
“status”: “success”,
“code”: 200,
“data”: {
“id”: 1,
“name”: “Product 1”,
“price”: 9.99
}
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *