JSON to DataTable Error

Hello. I was trying to Deserialize JSON to DataTable, but I have a problem. My Json looks like the below:

{
“result”: {
“list”: [
{
“atclNo”: “2435400759”,
“vrfcTpCd”: “OWNER”,
“atclNm”: “서신광진”,
“bildNm”: “106동”,
“tradTpNm”: “매매”,
“spc1”: “74.82”,
“spc2”: “59.98”,
“flrInfo”: “15/15”,
“atclFetrDesc”: “부분리모델링.빠른입주가능”,
“cfmYmd”: “24.07.18”,
“prcInfo”: “1억 2,300”,
“sameAddrCnt”: 7,
“sameAddrDirectCnt”: 0,
“sameAddrMaxPrc”: “1억 2,300”,
“sameAddrMinPrc”: “1억 2,300”,
“tradCmplYn”: “N”,
“atclStatCd”: “R0”,
“cpid”: “bizmk”,
“cpCnt”: 2,
“rltrNm”: “광진부동산공인중개사사무소”,
“direction”: “남향”,
},
{
“atclNo”: “2435304824”,
“vrfcTpCd”: “OWNER”,
“atclNm”: “서신광진”,
“bildNm”: “106동”,
“tradTpNm”: “매매”,
“spc1”: “74.82”,
“spc2”: “59.98”,
“flrInfo”: “2/15”,
“atclFetrDesc”: “샤시포함 부분 리모델링됨, 세입자 승계나 24년 4월 입주, 편하게 연락”,
“cfmYmd”: “24.07.18”,
“prcInfo”: “1억 4,500”,
“sameAddrCnt”: 6,
“sameAddrDirectCnt”: 0,
“sameAddrMaxPrc”: “1억 4,500”,
“sameAddrMinPrc”: “1억 4,000”,
“rltrNm”: “원탑공인중개사사무소”,
“direction”: “동향”,
}

I want to make the array data in the ‘list’ into a data table and store it in Excel. Perhaps because the ‘list’ is in the ‘result’, if you specify the value of dt as “Newtonsoft.Json.JsonConvert.DeserializeObject(jsonarray.ToString())” as an asset, the error continues.

my code is the below:

<?xml version="1.0" encoding="utf-16"?>True[dt][Newtonsoft.Json.JsonConvert.DeserializeObject(Of DataTable)(jsonarray.ToString())]

Hi @ecosy6065

Can you refer the below thread to convert Json to Datatable,

Hope it helps!!

Hi @ecosy6065

it’s error message.
Newtonsoft.Json.JsonSerializationException: Unexpected JSON token when reading DataTable: StartObject. Path ‘[0].result’. at Newtonsoft.Json.Converters.DataTableConverter.GetColumnDataType(JsonReader reader)
at Newtonsoft.Json.Converters.DataTableConverter.CreateRow(JsonReader reader, DataTable dt, JsonSerializer serializer)
at Newtonsoft.Json.Converters.DataTableConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObjectT
at Namespace_f9eb.시퀀스4_Expressions.시퀀스4_Expressions_TypedDataContext2_ForReadOnly.__Expr3Get()
at Namespace_f9eb.시퀀스4_Expressions.시퀀스4_Expressions_TypedDataContext2_ForReadOnly.ValueType___Expr3Get()
at Namespace_f9eb.시퀀스4_Expressions.InvokeExpression(Int32 expressionId, IList1 locations, ActivityContext activityContext) at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

error message. ㅠㅠ
Assign: Unexpected JSON token when reading DataTable: StartObject. Path ‘[0].result’.

@ecosy6065

  1. Use deserialize json and send string and get jobj as jobject
  2. Use deserailize json array and select type argument as Datatable and pass input as jobj("result")("list").ToString

cheers

Hi @ecosy6065
I think there are syntax errors in json
Try with below json data

{
  "result": {
    "list": [
      {
        "atclNo": "2435400759",
        "vrfcTpCd": "OWNER",
        "atclNm": "서신광진",
        "bildNm": "106동",
        "tradTpNm": "매매",
        "spc1": "74.82",
        "spc2": "59.98",
        "flrInfo": "15/15",
        "atclFetrDesc": "부분리모델링.빠른입주가능",
        "cfmYmd": "24.07.18",
        "prcInfo": "1억 2,300",
        "sameAddrCnt": 7,
        "sameAddrDirectCnt": 0,
        "sameAddrMaxPrc": "1억 2,300",
        "sameAddrMinPrc": "1억 2,300",
        "tradCmplYn": "N",
        "atclStatCd": "R0",
        "cpid": "bizmk",
        "cpCnt": 2,
        "rltrNm": "광진부동산공인중개사사무소",
        "direction": "남향"
      },
      {
        "atclNo": "2435304824",
        "vrfcTpCd": "OWNER",
        "atclNm": "서신광진",
        "bildNm": "106동",
        "tradTpNm": "매매",
        "spc1": "74.82",
        "spc2": "59.98",
        "flrInfo": "2/15",
        "atclFetrDesc": "샤시포함 부분 리모델링됨, 세입자 승계나 24년 4월 입주, 편하게 연락",
        "cfmYmd": "24.07.18",
        "prcInfo": "1억 4,500",
        "sameAddrCnt": 6,
        "sameAddrDirectCnt": 0,
        "sameAddrMaxPrc": "1억 4,500",
        "sameAddrMinPrc": "1억 4,000",
        "rltrNm": "원탑공인중개사사무소",
        "direction": "동향"
      }
    ]
  }
}

(post deleted by author)

1 Like

@ecosy6065

Sorry I am unable to get the data and deserializing from the Page you provided.
Open a new topic so,that some other will help you with this.
As you asked in the question,I think you got the solution with the json data I provided.
So please close this topic by marking my solution as solved.

Hope it helps!!