title: How can I get the JSON response of a POST request in a WebView?
body: <p>I've got a <code>WebView</code> with html containing a form (post). When clicking some submit button I get a JSON response.</p>
  
  <p>How can I get this JSON?</p>
  
  <p>If I don't intercept the request the json is displayed on the webview, so I guess I should use <code>shouldInterceptRequest</code> (I'm using API 12), but I don't know how to get the json in it.</p>
  
  <p>Or maybe there's a better way, like intercepting the response instead of the request?</p>
  
  <pre><code>mWebView.loadUrl(myURL);  
  
  isPageLoaded = false; // used because the url is the same for the response
  
  mWebView.setWebViewClient(new WebViewClient() {
      @Override
      public WebResourceResponse shouldInterceptRequest (WebView view, String url) {
  
          if(isPageLoaded){
              // get the json
              return null;
          }
          else return super.shouldInterceptRequest(view, url);
      }
  
      public void onPageFinished(WebView view, String url) {
          isPageLoaded = true;
      }
  });
  </code></pre>
  
  <p>Thanks</p>