Answers.Body: <p>the drush api command needs to be made "json aware" it seems indeed. It shouldn't be too complicated, want to give it a go and patch it?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-30T23:23:52.237Z
Answers.Text: Thanks @xavier, i'm battling with `cv` first up... will see how I go! maybe :-)
Answers.UserDisplayName: ErichBSchulz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-01T16:05:05.243Z
Answers.Text: Seems like we are moving toward `cv` as the standard cli tool over `drush` so probably ought to update the api explorer to reflect that change.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-15T22:37:04.563Z
Answers.Text: I would think adding cv but not removing drush makes sense
Answers.UserDisplayName: user4278
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-30T15:33:58.563Z
Answers.LastActivityDate: 2016-12-30T15:33:58.563Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>Here is how to pass an array to drush
  <code>
  echo '{"retrieval_parameters":{"jobId":97727336,"filePath":"Raw Recipient Data Export May 15 2017 22-07-43 PM 674.zip"}}'
  | drush cvapi Omnirecipients.get --in=json
  </code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-15T23:34:48.683Z
Answers.LastActivityDate: 2017-05-15T23:34:48.683Z
Answers.UserDisplayName: user4278
Body: <p>I'm building API extension that takes complex objects as parameters.</p>
  
  <p>The API exporer does a brilliant job at parsing the objects, but drush less so.</p>
  
  <p>Commands I am trying are:</p>
  
  <pre><code>`drush @contact cvapi Contact.getclif sequential=1 return="id" clif={"type":"raw","params":{"5":1,"6":1}} length=5`
  
  `drush @contact cvapi Contact.getclif sequential=1 return="id" clif='{"type":"raw","params":{"5":1,"6":1}}' length=5`
  </code></pre>
  
  <p>Both fail to json_decode the object and my API method receives a JSON string. </p>
  
  <p>I could decode the string in my API - but that feels a little hacky...</p>
  
  <p>Am I doing something wrong?</p>
  
  <p><a href="https://i.sstatic.net/QxtE6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QxtE6.png" alt="Screenshot of API explorer showing it working as expected"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-27T13:41:44.760Z
Comments.Text: If it is your objective is to execute API commands from the shell you can also use drush php-script.
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-27T21:45:02.110Z
Comments.Text: oh right! thanks! thats a good plan @Kainuk - I guess I'm still wondering if this is a bug or user error
Comments.UserDisplayName: ErichBSchulz
Tags: <api><drush>
Title: passing JSON objects to drush cvapi
ThreadText: # passing JSON objects to drush cvapi
  
  (Asked by: username_0 on 2016-12-27)
  
  I'm building API extension that takes complex objects as parameters.
  The API exporer does a brilliant job at parsing the objects, but drush less so.
  Commands I am trying are:
  `drush @contact cvapi Contact.getclif sequential=1 return="id" clif={"type":"raw","params":{"5":1,"6":1}} length=5`
  
  `drush @contact cvapi Contact.getclif sequential=1 return="id" clif='{"type":"raw","params":{"5":1,"6":1}}' length=5`
  
  Both fail to json_decode the object and my API method receives a JSON string. 
  I could decode the string in my API - but that feels a little hacky...
  Am I doing something wrong?
  
  **Tags:** api, drush
  
  > **Comments:**
  > **username_1**: If it is your objective is to execute API commands from the shell you can also use drush php-script.  
  > **username_0**: oh right! thanks! thats a good plan @Kainuk - I guess I'm still wondering if this is a bug or user error  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-12-30. Score: 1 | Accepted answer
  
  the drush api command needs to be made "json aware" it seems indeed. It shouldn't be too complicated, want to give it a go and patch it?
  
  > **Comments:**
  > **username_0**: Thanks @xavier, i'm battling with `cv` first up... will see how I go! maybe :-)  
  > **username_3**: Seems like we are moving toward `cv` as the standard cli tool over `drush` so probably ought to update the api explorer to reflect that change.  
  > **username_4**: I would think adding cv but not removing drush makes sense  
  
  ---
  
  ### Answer by username_4 on 2017-05-15. Score: 7
  
  Here is how to pass an array to drush
  `echo '{"retrieval_parameters":{"jobId":97727336,"filePath":"Raw Recipient Data Export May 15 2017 22-07-43 PM 674.zip"}}'
  | drush cvapi Omnirecipients.get --in=json`
  
  
  ---
  
  