반응형
□ json 파일
{
"Name":"TestWTPart_001",
"AssemblyMode": {
"Value": "separable",
"Display": "Separable"
},
"PhantomManufacturingPart" : false,
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:48507000')"
}
위 파일은 "C:\PTC\WORK90\example.JSON" 파일 이름으로 저장 되어 있습니다
□ 코드
Option Explicit
Public Sub exceljson()
Dim JSON, jsonObject As Object
Dim JsonText As String
Dim i As Integer
Dim FSO As New FileSystemObject
Dim JsonTS As TextStream
Set JsonTS = FSO.OpenTextFile("C:\PTC\WORK90\example.JSON ", ForReading)
JsonText = JsonTS.ReadAll
Debug.Print JsonText
JsonTS.Close
Set JSON = JsonConverter.ParseJson(JsonText)
MsgBox JSON("Name")
Set jsonObject = JSON("AssemblyMode")
MsgBox jsonObject("Value")
MsgBox jsonObject("Display")
MsgBox JSON("PhantomManufacturingPart")
MsgBox JSON("Context@odata.bind")
End Sub
참고 사이트
Import Json to excel and export excel to Json (Updated 2022) - Coding is Love
Excel doesn't have built-in support for JSON. Learn how to parse JSON in Excel VBA, import JSON to Excel and export Excel data using VBA-JSON.
codingislove.com
JSON 파일 유효성 검사
JSON Online Validator and Formatter - JSON Lint
Loading... About the JSONLint Editor JSONLint is a validator and reformatter for JSON, a lightweight data-interchange format. Copy and paste, directly type, or input a URL in the editor above and let JSONLint tidy and validate your messy JSON code. What Is
jsonlint.com
'VBA For Windchill' 카테고리의 다른 글
VBA Web Parsing 1/2 (0) | 2024.06.30 |
---|---|
Windchill에서 REST API의 빠른 테스트를 위해 객체 ID를 얻는 방법 (0) | 2024.06.28 |
Windchill & VBA 02) Creating a WTPart (부품) (0) | 2024.06.26 |
Windchill & VBA 02) NONCE Token (0) | 2024.06.25 |
학습 02) Open API, 엑셀 VBA (0) | 2024.06.22 |