コンテンツにスキップ

JSON 検索 (JSON Find)

指定した検索条件に基づいて JSON 配列内のアイテムを検索します。

説明 (Description)

JSON Find ノードは、JSON 配列を検索し、特定の条件に一致するアイテムを見つけ出します。複数の検索モード、大文字・小文字の区別オプションをサポートし、最初の一致項目またはすべての一致項目を返却できます。複雑なデータ構造のフィルタリングや検索に最適です。

パラメータ一覧 (Parameters)

入力パラメータ

パラメータ名 型 説明 デフォルト値
json json, str, dict 検索対象の JSON データ(配列または配列を含むオブジェクト) []
search_field str 検索対象フィールドへのドット記法パス(例: 'attributes.content') ""
search_value str 検索する値 ""
search_mode str 検索モード: 'exact', 'contains', 'starts_with' "exact"
return_mode str 返却モード: 最初の1件のみの場合は 'first'、全件の場合は 'all' "first"
case_sensitive bool 大文字と小文字を区別するかどうか true

出力パラメータ

パラメータ名 型 説明
found_item json 見つかったアイテム(return_mode が 'first' の場合は単一オブジェクト、'all' の場合は配列)
found_count int 見つかったアイテムの総数
found_index int 最初に一致したアイテムのインデックス番号(見つからない場合は -1)

主な機能 (Features)

  • 柔軟な検索モード: 完全一致 (Exact match)、部分一致 (Contains)、前方一致 (Starts with)
  • 大文字・小文字の区別制御: 検索時の大文字・小文字区別の ON/OFF
  • 多彩な返却オプション: 最初の一致項目のみ取得、またはすべての一致項目を一括取得
  • ネストされたフィールドへのアクセス: ドット記法で JSON 構造の深層まで探索
  • 配列の自動検出: 一般的なフィールド名から配列を自動検出
  • リアルタイム更新: 入力データの変更に応じて自動更新

検索モード (Search Modes)

完全一致 (exact)

フィールドの値が検索値と完全に一致するアイテムを検索します。

# 検索値: "Design"
# 一致: "Design"
# 不一致: "Design Task", "design", "My Design"

部分一致 (contains)

フィールドの値に検索値が部分文字列として含まれるアイテムを検索します。

# 検索値: "Design"
# 一致: "Design", "Design Task", "My Design Work"
# 不一致: "design"(case_sensitive=true の場合)

前方一致 (starts_with)

フィールドの値が検索値で始まるアイテムを検索します。

# 検索値: "Design"
# 一致: "Design", "Design Task", "Designer"
# 不一致: "My Design", "design"

フィールドパス構文 (Field Path Syntax)

search_field パラメータは、JSON Extract Value と同様のドット記法を使用します:

基本的なオブジェクトアクセス

search_field = "name"  # ルートの name フィールドを検索
search_field = "attributes.content"  # ネストされた content フィールドを検索
search_field = "user.profile.email"  # 深くネストされた email フィールドを検索

配列インデックス指定

search_field = "items[0].title"  # 最初のアイテムの title を検索
search_field = "users[2].name"  # 3番目のユーザーの name を検索

使用例 (Examples)

コンテンツによるタスクの検索

# 入力 JSON: [
#   {"attributes": {"content": "Design", "status": "wtg"}},
#   {"attributes": {"content": "Model", "status": "wtg"}},
#   {"attributes": {"content": "Design Review", "status": "ip"}}
# ]
# search_field: "attributes.content"
# search_value: "Design"
# search_mode: "exact"
# return_mode: "first"
# 結果: {"attributes": {"content": "Design", "status": "wtg"}}

ステータスに一致する全タスクの取得

# 入力 JSON: [
#   {"attributes": {"content": "Design", "status": "wtg"}},
#   {"attributes": {"content": "Model", "status": "wtg"}},
#   {"attributes": {"content": "Review", "status": "ip"}}
# ]
# search_field: "attributes.status"
# search_value: "wtg"
# search_mode: "exact"
# return_mode: "all"
# 結果: [{"attributes": {"content": "Design", "status": "wtg"}},
#        {"attributes": {"content": "Model", "status": "wtg"}}]
# 入力 JSON: [
#   {"name": "Design Task"},
#   {"name": "design review"},
#   {"name": "DESIGN WORK"}
# ]
# search_field: "name"
# search_value: "design"
# search_mode: "contains"
# case_sensitive: false
# return_mode: "all"
# 結果: 3つのアイテムすべて("Design", "design", "DESIGN" のいずれにも一致)

前方一致による検索

# 入力 JSON: [
#   {"title": "Design Task"},
#   {"title": "Design Review"},
#   {"title": "My Design Work"}
# ]
# search_field: "title"
# search_value: "Design"
# search_mode: "starts_with"
# return_mode: "all"
# 結果: [{"title": "Design Task"}, {"title": "Design Review"}]
# 入力 JSON: [
#   {
#     "relationships": {
#       "entity": {"data": {"name": "convertible", "type": "Asset"}}
#     }
#   }
# ]
# search_field: "relationships.entity.data.name"
# search_value: "convertible"
# search_mode: "exact"
# return_mode: "first"
# 結果: 一致したアイテム

配列の自動検出 (Array Auto-Detection)

入力 JSON が配列を含むオブジェクトである場合、ノードは以下のような一般的な配列フィールド名を自動的に探索します:

  • data
  • items
  • results
  • list
# 入力 JSON: {"data": [{"name": "Item 1"}, {"name": "Item 2"}]}
# ノードは自動的に "data" 配列内を検索します

ユースケース (Use Cases)

  • タスク管理: 内容、ステータス、担当者による特定タスクの検索
  • データフィルタリング: 特定条件に基づく大規模データセットの絞り込み
  • API レスポンス処理: API レスポンス内の配列データの探索
  • 設定ルックアップ: 特定の設定項目の検索
  • コンテンツ探索: コンテンツコレクションからの検索
  • ユーザー管理: 名前、メール、ロールによるユーザーの検索