title: Validating JSON query string as query param using Joi
body: <p>I have a problem of validation JSON that is passed in GET request query param as a serialized string.</p>
  
  <p>What I need to achieve is to parse this serialized string back to JSON and validated it using Joi.</p>
  
  <p>Example: Give is the JSON</p>
  
  <pre><code>{
   limit: {size:10, page:0},
   filter: {filter_by: 'foo', filter_val: 'foo', from: '1/1/2016',to: '1/1/2016' }
  }
  </code></pre>
  
  <p>And this JSON is converted to query string is:</p>
  
  <pre><code>limit%5Bsize%5D=10&amp;limit%5Bpage%5D=0&amp;filter%5Bfilter_by%5D=foo&amp;filter%5Bfilter_val%5D=foo&amp;filter%5Bfrom%5D=1%2F1%2F2016&amp;filter%5Bto%5D=1%2F1%2F2016
  </code></pre>
  
  <p>I need something like this to check:</p>
  
  <pre><code> validate: {
            query: {
              limit: Joi.someMethodToGetJsonFromString.object().keys({
                size: Joi.number(),
                page: Joi.number()
              }
            filter: Joi.someMethodToGetJsonFromString,.object().keys({
                filter_by: Joi.string().valid(['option1', 'option2']),
                filter_val: Joi.string(),
                from: Joi.date(),
                to: Joi.date(),
              }
          }
  </code></pre>
  
  <p>Is there anything in Joi that can help in this scenario, Or I need to write custom validation functions for it.</p>