title: Returning a JSONArray from JavascriptExecutor
body: <p>I am trying to return a JSONArray from JavascriptExecutor. Normally I can goto chrome browser and goto chrome's dev console and type: <code>"___grecaptcha_cfg.clients[0]"</code> which returns something similiar to this:</p>
  
  <p><a href="https://i.stack.imgur.com/X8BlS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X8BlS.png" alt="enter image description here"></a></p>
  
  <p>Though when I try this: </p>
  
  <pre><code>JavascriptExecutor js = (JavascriptExecutor) Browser;         
  Object  o = (Object) js.executeScript("return ___grecaptcha_cfg.clients[0];");
  </code></pre>
  
  <p>I get: </p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Maximum call stack size exceeded (Session info: chrome=69.0.3497.100) (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),
  platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds
  </code></pre>
  
  <p>Any idea of how I can overcome this?</p>
  
  <p>Thanks</p>
  
  <blockquote>
    <p>UPDATE</p>
  </blockquote>
  
  <p>It seems if I use:</p>
  
  <pre><code> Object o = (Object) js.executeScript("return ___grecaptcha_cfg.clients[0].Cy.C;");
  </code></pre>
  
  <p>I get back:</p>
  
  <pre><code>{action=null, badge=bottomright, bind=null, callback={}, content-binding=null, pool=null, preload=null, s=null, sitekey=flkgjsfldkjgsfdg, size=invisible, stoken=null, tabindex=null, theme=null, type=image}
  </code></pre>
  
  <p>which is what I am looking for, but the <code>Cy.C</code> is constantly changing. I need to be able to parse out the correct value that may change which currently is: </p>
  
  <pre><code>Cy.C
  </code></pre>
  
  <p>I'm assuming the value is too long? How could I correct this issue?</p>
  
  <blockquote>
    <p>Update 2</p>
  </blockquote>
  
  <p>using: </p>
  
  <pre><code>String script = "return JSON.stringify(___grecaptcha_cfg.clients[0]);";
  String str = (String) js.executeScript(script);
  </code></pre>
  
  <p>returns me <code>unknown error: Converting circular structure to JSON</code></p>
  
  <p>From searching around it seems my issue may be infinite recursion? Any suggestions on how to get around this? I do not need the returned object to be in json format, I just need to be able to parse out whether through a regex expression or something else:
  'Cy.C' which I can find by looking for <code>callback={}</code> or <code>sitekey={}</code> so I can build a string to call the callback.</p>