HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/nowruzgan/rest/node_modules/machinepack-json/tests/parse.json
{
  "machine": "parse",
  "expectations": [
    {
      "using": {
        "json": "{\"foo\": \"blah\" , \"stuff\": \"whatever\"}",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": "blah"
      }
    },
    {
      "using": {
        "json": "{\"foo\": \"blah\"}",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": "blah"
      }
    },
    {
      "using": {
        "json": "{\"some_other_key\": \"blah\"}",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": ""
      }
    },
    {
      "using": {
        "json": "\"something else completely wrong\"",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": ""
      }
    },
    {
      "using": {
        "json": "23582385",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": ""
      }
    },
    {
      "using": {
        "json": "true",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "success",
      "returns": {
        "foo": ""
      }
    },
    {
      "using": {
        "json": "something unparseable",
        "schema": {
          "foo": "bar"
        }
      },
      "outcome": "couldNotParse"
    },
    {
      "using": {
        "json": "[{\"stuff\": \"in here\"}]",
        "schema": [
          "*"
        ]
      },
      "outcome": "success",
      "returns": [
        {
          "stuff": "in here"
        }
      ]
    },
    {
      "using": {
        "json": "[{\"stuff\": \"in here\"}]",
        "schema": []
      },
      "outcome": "success",
      "returns": [
        {
          "stuff": "in here"
        }
      ]
    },
    {
      "using": {
        "json": "[{\"stuff\": \"in here\"}]",
        "schema": "*"
      },
      "outcome": "success",
      "returns": [
        {
          "stuff": "in here"
        }
      ]
    },
    {
      "using": {
        "json": "[{\"stuff\": \"in here\"}]"
      },
      "outcome": "success",
      "returns": [
        {
          "stuff": "in here"
        }
      ]
    },
    {
      "using": {
        "json": "\"hi\"",
        "schema": {
          "foo": "string"
        }
      },
      "outcome": "success"
    }
  ]
}