JSONファイルの扱い方について

以下のようなことを行いたいのですが、
3でエラーCannot access child value on Newtonsoft.Json.Linq.JValueになり値を取得できません。
ちなみに、2で同じことをしたら取得できます。

1.1.xamlにて、JSONを逆シリアル化し、Jsonオブジェクトの変数「objJson」(型はJObject)に出力する
2.2.xamlにて、1.xamlのobjJsonを引数In_objJsonで受け取る
3.2.xamlにて、In_objJsonの中身のデータを1行書き込みする
1行書き込みアクティビティ
In_objJson(“name”).ToString

何が原因かわからず、お力添えいただけますと幸いです。

Hi @chantee

  1. 1.xaml - Deserialize JSON and Output to Variable:
  • Use the Deserialize JSON activity to deserialize your JSON data.
  • Output the deserialized JSON to a variable named “objJson” of type JObject.
  1. 2.xaml - Access and Display “name” Value:
  • Create an In_objJson argument of type JObject in your 2.xaml workflow to receive the JSON object from 1.xaml.
  • Inside the 2.xaml workflow, use the Write Line activity to directly access and display the value of the “name” field:
In_objJson("name").ToString  // Outputs the value of the "name" field

Hope it helps!!

こんにちは

対象のJSONファイルの構造はどのようになっていますか?直下にnameキーが存在していますでしょうか?

さっそくのご回答ありがとうございます。
直下にnameが存在しており、
引数の受け渡し元である1.xamlでは1行書き込みができている状態です。

こんにちは

手元の環境ではワークフロー呼び出しアクティビティ経由しても、特に問題なく動作します。

ダミーでも良いので事象再現できるプロジェクト共有可能でしょうか?

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