JSON
2023. 7. 27.

https://cafe.naver.com/hansungkkdigital

 

한성대 K디지털 유니티 : 네이버 카페

한성대 K디지털 유니티

cafe.naver.com

 

1.엑셀 파일 만들기

2. 복사후,  https://shancarter.github.io/mr-data-converter/ 에서 변환

3. 메모장에 옮긴 후 이름바꿔 저장

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Starcraft
{
    public class App
    {
        //생성자
        public App()
        {
            //파일을 읽기
            string json = File.ReadAllText("./item_data.json");
            Console.WriteLine(json);
        }
    }

}

파일을 경로에 넣고 실행.

이 때 System.IO 추가해야 File.ReadAllText를 쓸 수 있다.

 

newtonsoft.json설치

 

newtonsoft 네임스페이스 추가및 코드수정

newtonsoft 네임스페이스 추가

 

'C# 기초' 카테고리의 다른 글

JSON, 데이터 관리연습2-아이템 가방에 넣고 착용하기  (0) 2023.07.28
JSON, 데이터 관리 연습  (0) 2023.07.28
대리자2, Action, Func, 람다활용,  (0) 2023.07.27
대리자  (0) 2023.07.27
개체 이니셜라이저  (0) 2023.07.26
myoskin