title: Fetch json array in PostgreSQL procedure
body: <p>I'm using PgSQL9.6.</p>
  
  <p>I have procedure named as <code>createBooking</code> in PgSQL. It receive few parameters and one of them is <code>additional</code> type text. </p>
  
  <p>Request is  </p>
  
  <p><code>{ 
      "email": "user2@name.com",
      "start_date": "2016-10-21 11:00:00+00",
      "end_date": "2016-10-21 15:00:00+00",
      "guests": 50,
      "firstname": "User",
      "lastname": "Name",
      "payment_type": "Method 1",
      "phone": "+871253875123",
      "user_id": 22,
      "y_id": 3,
      "additionals": [
          {
              "extrasId": 6,
              "money": 19750,
              "packageId": null,
              "amount": 3
          },
          {
              "extrasId": 11,
              "money": 64380,
              "packageId": null,
              "amount": 5
          },
          {
              "extrasId": null,
              "money": null,
              "packageId": 3,
              "amount": 1
          }
      ]
  }</code></p>
  
  <p>I'm trying fetch 'additioanl'.</p>
  
  <p><code>FOR i IN SELECT json_array_elements(createBooking.additional)
  LOOP
      sum := sum + i-&gt;&gt;'money';
  END LOOP;</code></p>
  
  <p>It does not mater what is in body of loop. 
  When I calling this function via PostMan it is sending me response with error.</p>
  
  <p><code>{
    "hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
    "details": null,
    "code": "42883",
    "message": "function json_array_elements(text) does not exist"
  }</code></p>
  
  <p>Can some body explain me how should I fetch it?
  Thank you.</p>