본문 바로가기
개발/게임) 개발관련

VisualStudio)Json Schema (JSON 스키마)

by 테샤르 2023. 9. 19.

Json Schema (JSON 스키마)

JSON Schema에 대해서 간략하게 정리한다.

JSON 스키마(Schema)란 JSON의 형식이 맞는지 유효성을 검사를 하기 위한 선언적 언어로 JSON 스키마를 사용하면 JSON 형식을 확실하고 안정적으로 사용이 가능하다고 한다.

 

기본적으로 만들어져있는 Schema를 사용하는것을 권장한다.

 

 

반응형

기본적으로 설치되어있는 스키마를 보면 다음과 같다.

https://json.schemastore.org/foxx-manifest.json

 

 

<예시 : 주소 스키마>

{
  "$id": "https://example.com/address.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "An address similar to http://microformats.org/wiki/h-card",
  "type": "object",
  "properties": {
    "post-office-box": {
      "type": "string"
    },
    "extended-address": {
      "type": "string"
    },
    "street-address": {
      "type": "string"
    },
    "locality": {
      "type": "string"
    },
    "region": {
      "type": "string"
    },
    "postal-code": {
      "type": "string"
    },
    "country-name": {
      "type": "string"
    }
  },
  "required": [ "locality", "region", "country-name" ],
  "dependentRequired": {
    "post-office-box": [ "street-address" ],
    "extended-address": [ "street-address" ]
  }
}

 

<VisualStudio JSON 옵션>

추가적으로 Visual Studio 에서 JSON의 기본 형식과 스키마도 편집이 가능하다.

[도구] - [옵션] - [JSON]

[도구] - [옵션] - [JSON Schema Editor]

 

JSON Schema : [링크]

 

JSON Schema

The home of JSON Schema

json-schema.org

JSON Schema 상세 설명 : [링크]

 

Understanding JSON Schema — Understanding JSON Schema 2020-12 documentation

Understanding JSON Schema JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its specification is like learning to drive a car by looking at its blueprints. You don’t need to know how an elect

json-schema.org

 

★☆☆☆☆

 

반응형

댓글