우편으로 보내는 아이템 json 분리 문의

문의 응대 : 평일 오전 10시 ~ 오후 6시
문의를 남기실 경우 다음 항목을 작성해 주세요.
정보가 부족하거나 응대시간 외 문의하는 경우 확인 및 답변이 지연될 수 있습니다.

  • 뒤끝 SDK 버전 : 5.7.0
  • 프로젝트명 : Loheldi Project
  • 스테이터스 코드 :
  • 에러 코드 :
  • 에러 메시지 : InvalidOperationException: The JsonData instance has to be initialized first

안녕하세요 잘 사용하고 있습니다. 지금 하고 싶은 작업은 우편으로 유저들에게 콘솔에서 아이템을 보냈을 때 그것을 수령하고 메일 우편 전용 테이블로 삽입시키려는 작업을 하고 있습니다. 그런데 우편에서 날아오는 json 파일을 분리하는 과정에서 어려움을 겪고 있어서 문의 드립니다. 코드 첨부합니다

public class MailLoad : MonoBehaviour
{
public Text RTitleText; //우측에 표시되는 메일 제목
public Text RDetailText; //우측에 표시되는 메일 내용
public GameObject ThisTitle; //메일 제목
public GameObject ThisSent; //보낸 사람
public GameObject ThisDetail; //메일 내용
public Transform MailList; //매일들이 정렬될 ParentObject
public GameObject TempObject;

public Text NoticeTitleText;
public Text NoticeSentText;
public Transform NoticeList;
public GameObject NoticeTitle;
public GameObject NoticeSent;
public GameObject NoticeObject;


Dictionary<string, string> icode = new Dictionary<string, string>();
Dictionary<string, string> iname = new Dictionary<string, string>();
Dictionary<string, string> price = new Dictionary<string, string>();

public void ReceiveMail()
{

    var bro = Backend.UPost.ReceivePostItemAll(PostType.Admin);

    if (bro.IsSuccess())
    {
        foreach (LitJson.JsonData postItems in bro.GetReturnValuetoJSON()["postItems"])
        {
            if (postItems.Count <= 0)
            {
                Debug.Log("아이템이 없는 우편 수령");
                continue;
            }
            else
            {
                
                string itemCode = (string)bro.FlattenRows()[0];

                Param param = new Param();
                icode.Add ("itemCode", itemCode);
                

                param.Add("MailItem", icode);
                bro = Backend.GameData.Insert("MAILITEM", param);
            }

        }
    }
    else
    {
        if (bro.GetErrorCode() == "NotFoundException")
        {
            Debug.LogError("더이상 수령할 우편이 존재하지 않습니다.");
        }
    }
}

안녕하세요 개발자님,

{
    "postItems": [
        [], // 첨부된 아이템이 없을 경우
        [
            {
                "item": { // 첨부된 아이템이 하나일 경우
                    "chartFileName": "chartExample.xlsx",
                    "itemID": "i101",
                    "itemName": "아이템111",
                    "hpPower": "1",
                    "aabab": "1"
                },
                "itemCount": 1,
                "chartName": "Chart"
            }
        ]
    ]
}

JSON에서 접근하고자 하는 데이터가 없을 경우 해당 에러가 발생할 수 있습니다.
Debug.Log(bro)를 통해 리턴값을 확인해주세요.

위와 같은 리턴값의 경우 아래와 같이 접근이 가능합니다

var bro = Backend.UPost.ReceivePostItemAll(PostType.Admin);
string chartFileName = bro["postItems"][1][0]["item"]["chartFileName"].ToString();

int itemCount = Int32.Parse(bro["postItems"][1][0]["itemCount"].ToString());