Skip to content
Browse all functions

Search in All Keys in a JSON Object

data/deepsearchjson

deepsearchjson (Search in All Keys in a JSON Object) is a 1001fx API function in the group Data & JSON: POST https://api.1001fx.com/data/deepsearchjson, 2 credits per call. It works as a ready-made module in Make and n8n or as a plain HTTP call.

2 credits per callHTTP APIn8nMake

Deep searches in all keys of a given JSON object. The result is an array of key/value pairs the matches the criteria.

Try it in the 1001fx app

Run deepsearchjson in your browser with your API key – fill the form, click Run and get the answer or the file.

deepsearchjson in the 1001fx app: the form with example values
Search in All Keys in a JSON Object in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/data/deepsearchjson
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json

Parameters

  • jsonobjectoptional

    Object to search in

  • jsonStringstringoptional

    Stringified JSON to search in

    Example:
    {"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"}
  • searchStringstringrequired

    String to search for

    Example:
    car
  • scopeenumoptional

    Scope to search in - 'keys' is default

    Values:
    keys
    values
    all
    Default:
    keys
    Example:
    keys
  • comparisonenumrequired

    Comparison method

    Values:
    equal
    equal_case_insensitive
    startswith
    endswith
    contains
    Default:
    equal
    Example:
    endswith

Examples

Search keys (equal)

Finds keys named "car"; returns 1 match.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "comparison": "equal",
  "searchString": "car",
  "scope": "keys"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "car": "BMW"
      }
    ],
    "count": 1
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"comparison":"equal","searchString":"car","scope":"keys"}'

Search values (equal)

Finds values equal to "car"; returns 1 match.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "car",
  "comparison": "equal",
  "scope": "values"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "transport": "car"
      }
    ],
    "count": 1
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"car","comparison":"equal","scope":"values"}'

Search keys and values (equal)

Finds keys and values equal to "car"; returns 2 matches.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "car",
  "comparison": "equal",
  "scope": "all"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "transport": "car"
      },
      {
        "car": "BMW"
      }
    ],
    "count": 2
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"car","comparison":"equal","scope":"all"}'

Equal, ignoring case

searchString "CAR" with comparison equal_case_insensitive; returns 2 matches.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "CAR",
  "scope": "all",
  "comparison": "equal_case_insensitive"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "transport": "car"
      },
      {
        "car": "BMW"
      }
    ],
    "count": 2
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"CAR","scope":"all","comparison":"equal_case_insensitive"}'

Starts with

Keys and values starting with "ca"; returns 2 matches.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "ca",
  "scope": "all",
  "comparison": "startswith"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "transport": "car"
      },
      {
        "car": "BMW"
      }
    ],
    "count": 2
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"ca","scope":"all","comparison":"startswith"}'

Ends with

Keys and values ending with "ar"; returns 2 matches.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "ar",
  "scope": "all",
  "comparison": "endswith"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "transport": "car"
      },
      {
        "car": "BMW"
      }
    ],
    "count": 2
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"ar","scope":"all","comparison":"endswith"}'

Contains

Keys and values containing "a"; returns 3 matches.

Input

Expects a json body
{
  "json": {
    "foundation": "Mozilla",
    "model": "box",
    "week": 45,
    "transport": "car",
    "month": 7,
    "car": "BMW"
  },
  "searchString": "a",
  "scope": "all",
  "comparison": "contains"
}

Output · HTTP 200

Response
{
  "result": {
    "data": [
      {
        "foundation": "Mozilla"
      },
      {
        "transport": "car"
      },
      {
        "car": "BMW"
      }
    ],
    "count": 3
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/deepsearchjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"foundation":"Mozilla","model":"box","week":45,"transport":"car","month":7,"car":"BMW"},"searchString":"a","scope":"all","comparison":"contains"}'

Try deepsearchjson now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.001.03.2023created
Ask 1001fx