Deserialize JSON의 결과값에서 String만 뽑아내려면 어떻게 해야하나요?

JSON String은 다음과 같습니다.
여기에서 order의 값을 발췌하면 String이 안뽑혀요.
{
“order”: [
“3y8zzti15fd4ufpn6g9jrb1iwy”
],
“posts”: {
“3y8zzti15fd4ufpn6g9jrb1iwy”: {
“id”: “3y8zzti15fd4ufpn6g9jrb1iwy”,
“create_at”: 1700057916041,
“update_at”: 1700057916041,
“edit_at”: 0,
“delete_at”: 0,
“is_pinned”: false,
“user_id”: “9t74dxy81p83bq1swk7f9xas1h”,
“channel_id”: “xcbxanmc47gw9gh4z13ddts7ba”,
“root_id”: “”,
“original_id”: “”,
“message”: “ououegk867f9bqxoz3yys4aiqh”,
“type”: “”,
“props”: {
“disable_group_highlight”: true
},
“hashtags”: “”,
“pending_post_id”: “”,
“reply_count”: 0,
“last_reply_at”: 0,
“participants”: null,
“metadata”: {}
}
},
“next_post_id”: “”,
“prev_post_id”: “4unn7a57t7y7mrno68ez4dq5gy”,
“has_next”: false,
“first_inaccessible_post_time”: 0
}


JSONOBJ.SelectToken(“order”).toString 으로 데이터를 뽑으면
[
“3y8zzti15fd4ufpn6g9jrb1iwy”
]

결과값이 나오는데

실제로 제가 원하는건 message 인데
이걸 뽑으려면 order 값을 제대로 뽑아내야 message를 가져올 수 있어서요.

어떻게 하면 될까요?

Hi @mountie

could you try this

JSONOBJ.SelectToken("posts").SelectToken(JSONOBJ.SelectToken("order")(0).ToString).SelectToken("message").ToString

returned that

23.10.0+Branch.master.Sha.e038c5a32a4f890ba12a3c04ac465dc8811521e0

소스: Message Box

메시지: 식 작업 형식 'VisualBasicValue`1’을(를) 실행하려면 컴파일해야 합니다. 워크플로가 컴파일되었는지 확인하십시오.

예외 형식: System.NotSupportedException

System.NotSupportedException: 식 작업 형식 'VisualBasicValue1'을(를) 실행하려면 컴파일해야 합니다. 워크플로가 컴파일되었는지 확인하십시오. at System.Activities.Expressions.CompiledExpressionInvoker.InvokeExpression(ActivityContext activityContext) at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(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, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Please check the double quotation " in the expression. My keyboard layout may vary from yours

JsonObj.SelectToken("posts").SelectToken(JsonObj.SelectToken("order")(0).ToString).SelectToken("message").ToString

it works.
thank you

1 Like

Thank you for let me know

Kindly mark as solution to help others with the same questions

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.