title: How to get put option price with json format?
body: <p>I want to download the option chain data from google finance, and here I find a R script to download, it is useful, I've changed it capable to download multiple expiry dates option price, but the origin json link seems to only have the call option data, how can I get put option data.</p>
  
  <pre><code>library(rjson)
  
  getOptionChain &lt;- function (symbol,exp) {
    # symbol = "WMT"  
  
    url &lt;- "https://www.google.com/finance/option_chain?q="
    # url &lt;- paste(url, symbol, "&amp;expd=15&amp;expm=01&amp;expy=2016&amp;output=json", sep="")
    url &lt;- paste(url, symbol, "&amp;output=json", sep="")
  
    google.options.json &lt;- readLines(url, warn = FALSE)
  
    options.json &lt;- google.options.json
    options.json &lt;- gsub("[{]", "{\"", options.json)
    options.json &lt;- gsub("[:]", "\":", options.json)
    options.json &lt;- gsub("[,] ", "$$$", options.json)
    options.json &lt;- gsub("[,]", ",\"", options.json)
    options.json &lt;- gsub("[,]\"[{]", ",{", options.json)
    options.json &lt;- gsub("[$][$][$]", ", ", options.json)
  
    options.list &lt;- fromJSON(options.json)
  
    #get the options chain without an expiry date and then determine longest option
  
    last.expiration &lt;- length(options.list[["expirations"]])
    if ( exp&gt;0 &amp;&amp; exp&lt; last.expiration) {
      last.expiration &lt;-exp
    } 
    month &lt;- sprintf("%02d", options.list[["expirations"]][[last.expiration]]$m)
    day &lt;- sprintf("%02d", options.list[["expirations"]][[last.expiration]]$d )
    year &lt;- options.list[["expirations"]][[last.expiration]]$y
  
    #now request option chain for the longest expiry
  
    url &lt;- "https://www.google.com/finance/option_chain?q="
    url &lt;- paste(url, symbol, "&amp;expd=", day, "&amp;expm=", month, "&amp;expy=", year, "&amp;output=json", sep="")
  
    google.options.json &lt;- readLines(url, warn = FALSE)
  
    options.json &lt;- google.options.json
    options.json &lt;- gsub("[{]", "{\"", options.json)
    options.json &lt;- gsub("[:]", "\":", options.json)
    options.json &lt;- gsub("[,] ", "$$$", options.json)
    options.json &lt;- gsub("[,]", ",\"", options.json)
    options.json &lt;- gsub("[,]\"[{]", ",{", options.json)
    options.json &lt;- gsub("[$][$][$]", ", ", options.json)
  
    options.list &lt;- fromJSON(options.json)
  
    options &lt;- ldply (options.list[["calls"]], data.frame)
    options &lt;- rename(options, c("s" = "contract.name",
                                 "p" = "price",
                                 "b" = "bid", 
                                 "a" = "ask",
                                 "c" = "change",
                                 "cp" = "change.percentage",
                                 "oi" = "open.interest",
                                 "vol" = "volume"))
    options &lt;- options[c( "contract.name", 
                          "strike",
                          "price", 
                          "change", 
                          "change.percentage",
                          "bid", 
                          "ask", 
                          "volume",
                          "open.interest")]
  
  
    options$expiry &lt;- paste(options.list[["expiry"]]$m, options.list[["expiry"]]$d, options.list[["expiry"]]$y, sep = "/")
  
    last.expiration &lt;- length(options.list[["expirations"]])
    options$longest.available.expiry &lt;- paste(options.list[["expirations"]][[last.expiration]]$m,
                                              options.list[["expirations"]][[last.expiration]]$d, 
                                              options.list[["expirations"]][[last.expiration]]$y, sep = "/")
  
    options$underlying.price &lt;- options.list[["underlying_price"]]
  
    return(options)
  } 
  </code></pre>