title: How can I get a Javascript variable value in Java?
body: <p>In my current project I have to read a JavaScript file from the web and extract an object from it. The variable can vary from time to time, so I have to read it instead of hard coding it into my android app.</p>
  
  <p>Say I want to extract the following variable (and parse the string using JSONObject after that, which is trivial):</p>
  
  <pre><code>var abc.xyz = {
  "a": {"one", "two", "three"},
  "b": {"four", "five"}
  }
  </code></pre>
  
  <p>I have a problem with this. Do I have to implement some compiler-like scanner just to look for the name and get its value, or there is some existing tool I can use?</p>
  
  <p>The JavaScript file is not as simple as this example. It contains a lot of other code. So a simple <code>new JSONObject()</code> or something will not do.</p>