---
title: Best Match (Multiple)
slug: best-match-multiple
docTags: 
createdAt: 2021-12-22T07:28:32.000Z
---

Evaluates and returns the first non empty match of two JSON Objects provided. The function looks to exclude nulls, non-json values or json objects without any keys.

rules supported are "first\_*not\_*&#x65;mpty"



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/json/bestmatch",
  "name": "Best Match API",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "28UsDqyeH3QRdmtVamSQT",
        "code": "{\n    \"output\": {\n\t\t\t\t\t\"second_json\":\"has_value\"\n\t\t\t\t}\n}",
        "language": "200"
      },
      {
        "id": "yIX64DyIuDPJgBRFSfAWb",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "28UsDqyeH3QRdmtVamSQT"
  },
  "examples": {
    "languages": [
      {
        "id": "ENcJz9TStG38F0X-taA4x",
        "code": "{\r\n\t\"bestmatches\": {\r\n\t\t\"best_match\": {\r\n\t\t\t\"input\": [\r\n\t\t\t\tnull,\r\n\t\t\t\t{\r\n\t\t\t\t\t\"second_json\":\"has_value\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"rule\": \"first_not_empty\"\r\n\t\t\t\"default\":{\r\n\t\t\t\t\"default_json\":\"none found\"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "ENcJz9TStG38F0X-taA4x"
  },
  "description": "\nCall the following API:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::















