Internet Explorerer Parses JSON differently than all other browsers in Rails -
i have json object. if parse in internet explorer:
(rdb:776) parsed_json = activesupport::json.decode(params[:json]) standarderror exception: invalid json string
yet if in other browser, same param succeeds..
what may cause of ?
the json passes
"{\"results\":[{\"date_paid\":\"2/27/2008\",\"interest_rate\":5.5,\"date_awarded\":\"02/02/2008\",\"total_interest\":7.66,\"tf\":0.0712328767123288,\"principal\":1955.96,\"amount_paid\":100.0},{\"date_paid\":\"12/31/2008\",\"interest_rate\":5.5,\"date_awarded\":\"02/28/2008\",\"total_interest\":86.14,\"tf\":0.843835616438356,\"principal\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/2009\",\"interest_rate\":4.0,\"date_awarded\":\"1/1/2009\",\"total_interest\":74.24,\"tf\":1.0,\"principal\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/2010\",\"interest_rate\":1.5,\"date_awarded\":\"1/1/2010\",\"total_interest\":27.84,\"tf\":1.0,\"principal\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"02/09/2011\",\"interest_rate\":0.5,\"date_awarded\":\"1/1/2011\",\"total_interest\":1.02,\"tf\":0.10958904109589,\"principal\":1855.96,\"amount_paid\":0.0}],\"docket_num\":\"\",\"total_days\":{\"numerator\":95299200,\"denominator\":1},\"interest_rate\":0.005,\"our_file_num\":\"\",\"total_sum_interest\":196.9,\"payments\":[{\"date_paid\":\"2/27/2008\",\"date_awarded\":\"02/02/2008\",\"total_interest\":7.66,\"judgement_balance\":1955.96,\"amount_paid\":100.0},{\"date_paid\":\"12/31/2008\",\"date_awarded\":\"02/28/2008\",\"total_interest\":86.14,\"judgement_balance\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/2009\",\"date_awarded\":\"1/1/2009\",\"total_interest\":74.24,\"judgement_balance\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/2010\",\"date_awarded\":\"1/1/2010\",\"total_interest\":27.84,\"judgement_balance\":1855.96,\"amount_paid\":0.0},{\"date_paid\":\"02/09/2011\",\"date_awarded\":\"1/1/2011\",\"total_interest\":1.02,\"judgement_balance\":1855.96,\"amount_paid\":0.0}],\"total_interest\":196.9,\"per_diem\":0.179,\"tf\":0.10958904109589,\"lda\":false}"
the json fails
"{\"results\":[{\"date_paid\":\"12/31/1981\",\"interest_rate\":12.0,\"date_awarded\":\"02/02/1981\",\"total_interest\":214.14,\"tf\":0.912328767123288,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1982\",\"interest_rate\":12.0,\"date_awarded\":\"1/1/1982\",\"total_interest\":234.72,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1983\",\"interest_rate\":12.0,\"date_awarded\":\"1/1/1983\",\"total_interest\":234.72,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1984\",\"interest_rate\":12.0,\"date_awarded\":\"1/1/1984\",\"total_interest\":235.36,\"tf\":1.0027397260274,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1985\",\"interest_rate\":12.0,\"date_awarded\":\"1/1/1985\",\"total_interest\":234.72,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1986\",\"interest_rate\":9.5,\"date_awarded\":\"1/1/1986\",\"total_interest\":185.82,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1987\",\"interest_rate\":7.5,\"date_awarded\":\"1/1/1987\",\"total_interest\":146.7,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1988\",\"interest_rate\":6.0,\"date_awarded\":\"1/1/1988\",\"total_interest\":117.68,\"tf\":1.0027397260274,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1989\",\"interest_rate\":7.0,\"date_awarded\":\"1/1/1989\",\"total_interest\":136.92,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1990\",\"interest_rate\":8.0,\"date_awarded\":\"1/1/1990\",\"total_interest\":156.48,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1991\",\"interest_rate\":8.5,\"date_awarded\":\"1/1/1991\",\"total_interest\":166.26,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1992\",\"interest_rate\":7.5,\"date_awarded\":\"1/1/1992\",\"total_interest\":147.1,\"tf\":1.0027397260274,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1993\",\"interest_rate\":5.5,\"date_awarded\":\"1/1/1993\",\"total_interest\":107.58,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1994\",\"interest_rate\":3.5,\"date_awarded\":\"1/1/1994\",\"total_interest\":68.46,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1995\",\"interest_rate\":3.5,\"date_awarded\":\"1/1/1995\",\"total_interest\":68.46,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1996\",\"interest_rate\":5.5,\"date_awarded\":\"1/1/1996\",\"total_interest\":107.87,\"tf\":1.0027397260274,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1997\",\"interest_rate\":5.5,\"date_awarded\":\"1/1/1997\",\"total_interest\":107.58,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12/31/1998\",\"interest_rate\":5.5,\"date_awarded\":\"1/1/1998\",\"total_interest\":107.58,\"tf\":1.0,\"principal\":1955.96,\"amount_paid\":0.0},{\"date_paid\":\"12"
how caused
this controller :
@json = @calc.to_json
this view :
= form_tag generate_csv_path(:json => @json) = submit_tag 'print csv', :id => "print_csv"
the "json fails" missing \"}
@ end of it. (just cursory glance)
Comments
Post a Comment