title: Get email from JSON array
body: <p>I am trying to use fiken.no`s API to retrieve customernumbers. The API is HAL+JSON based and I want to access the data with PHP.</p>
  <p>When creating a new account you receive no response, but only HTTP 201, so to get the generated customernumber I need to use the search endpoint.</p>
  <p>That endpoint only returns all users like this:</p>
  <pre><code>{
  &quot;_links&quot;: {
      &quot;self&quot;: {
          &quot;href&quot;: &quot;https://fiken.no/api/v1/companies/fiken-demo-personlig-gnist-enk/contacts&quot;
      }
  },
  &quot;_embedded&quot;: {
      &quot;https://fiken.no/api/v1/rel/contacts&quot;: [
          {
              &quot;_links&quot;: {
                  &quot;self&quot;: {
                      &quot;href&quot;: &quot;https://fiken.no/api/v1/companies/fiken-demo-personlig-gnist-enk/contacts/757941482&quot;
                  }
              },
              &quot;name&quot;: &quot;Ola Nordmann 2&quot;,
              &quot;email&quot;: &quot;mail@mail.com&quot;,
              &quot;address&quot;: {
                  &quot;country&quot;: &quot;Norge&quot;
              },
              &quot;customerNumber&quot;: 10003
          },
          {
              &quot;_links&quot;: {
                  &quot;self&quot;: {
                      &quot;href&quot;: &quot;https://fiken.no/api/v1/companies/fiken-demo-personlig-gnist-enk/contacts/757941171&quot;
                  }
              },
              &quot;name&quot;: &quot;Ola Nordmann 1&quot;,
              &quot;email&quot;: &quot;findthis@example.com&quot;,
              &quot;address&quot;: {
                  &quot;country&quot;: &quot;Norge&quot;
              },
              &quot;customerNumber&quot;: 10002
          },
          {
              &quot;_links&quot;: {
                  &quot;self&quot;: {
                      &quot;href&quot;: &quot;https://fiken.no/api/v1/companies/fiken-demo-personlig-gnist-enk/contacts/756867201&quot;
                  }
              },
              &quot;name&quot;: &quot;Demoleverandør&quot;,
              &quot;address&quot;: {
                  &quot;address1&quot;: &quot;Demoveien 44&quot;,
                  &quot;address2&quot;: &quot;&quot;,
                  &quot;postalPlace&quot;: &quot;Oslo&quot;,
                  &quot;postalCode&quot;: &quot;0190&quot;,
                  &quot;country&quot;: &quot;Norge&quot;
              },
              &quot;supplierNumber&quot;: 20001
          },
          {
              &quot;_links&quot;: {
                  &quot;self&quot;: {
                      &quot;href&quot;: &quot;https://fiken.no/api/v1/companies/fiken-demo-personlig-gnist-enk/contacts/756867200&quot;
                  }
              },
              &quot;name&quot;: &quot;Demokunde&quot;,
              &quot;address&quot;: {
                  &quot;address1&quot;: &quot;Demoveien 22&quot;,
                  &quot;address2&quot;: &quot;&quot;,
                  &quot;postalPlace&quot;: &quot;Oslo&quot;,
                  &quot;postalCode&quot;: &quot;0190&quot;,
                  &quot;country&quot;: &quot;Norge&quot;
              },
              &quot;customerNumber&quot;: 10001
          }
      ]
  }}
  </code></pre>
  <p>From this response I need to query for f.ex the email findthis@example.com and get the whole user object from that. That includes the address data and especially the customernumber. How would I do that?</p>
  <p>I have found this: <a href="https://stackoverflow.com/questions/34537356/search-a-key-in-a-json-nested-array-php">Search a key in a Json (nested array) PHP</a> that looks like my issues but here the key is constant in the JSON array. Here it is from 0 and out to infinity.</p>
  <p>Is there any better way to process this using PHP than normal JSON practices?</p>