Analysis of the JSON reveals no issues:
require 'json'
str = <<EOT
{"data": "[{'Docket Type': 'MOT - MOTION','Filing Date': '19-AUG-2015','Filing Party': 'PNC BANK, NATIONAL ASSOCIATION,','Docket Text': 'TO GRANT WRIT OF POSSESSION FOR FAILURE TO VACATE PREMISES F\\B PLT, PNC BANK'},{'Docket Type': 'AFF - AFFIDAVIT','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': 'PURSUANT TO SECTION 83.561, FLORIDA STATUTES F\\B PLT, PNC'},{'Docket Type': '108FF - CAFF/REOPEN ($50.00)','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': '<i>none.</i>'},{'Docket Type': 'RO - REOPEN','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': '<i>none.</i>'},{'Docket Type': 'COS - CERTIFICATE OF SERVICE','Filing Date': '14-JUL-2015','Filing Party': 'NATIONAL CITY BANK,','Docket Text': 'OF ORDER ON OBJECTION TO FORECLOSURE SALE F/B PLT'},{'Docket Type': 'CRT - CERTIFICATE','Filing Date': '01-JUL-2015','Filing Party': ' ','Docket Text': 'OF DISBURSEMENTS'},{'Docket Type': 'COFT - CERTIFICATE OF TITLE','Filing Date': '01-JUL-2015','Filing Party': ' ','Docket Text': 'WAS SOLD TO PNC BANK N...
EOT
JSON[str]
# => {"data"=>
# "[{'Docket Type': 'MOT - MOTION','Filing Date': '19-AUG-2015','Filing Party': 'PNC BANK, NATIONAL ASSOCIATION,','Docket Text': 'TO GRANT WRIT OF POSSESSION FOR FAILURE TO VACATE PREMISES FB PLT, PNC BANK'},{'Docket Type': 'AFF - AFFIDAVIT','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': 'PURSUANT TO SECTION 83.561, FLORIDA STATUTES FB PLT, PNC'},{'Docket Type': '108FF - CAFF/REOPEN ($50.00)','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': '<i>none.</i>'},{'Docket Type': 'RO - REOPEN','Filing Date': '19-AUG-2015','Filing Party': ' ','Docket Text': '<i>none.</i>'},{'Docket Type': 'COS - CERTIFICATE OF SERVICE','Filing Date': '14-JUL-2015','Filing Party': 'NATIONAL CITY BANK,','Docket Text': 'OF ORDER ON OBJECTION TO FORECLOSURE SALE F/B PLT'},{'Docket Type': 'CRT - CERTIFICATE',...
<p>I'm using Ruby version 2.2.3.</p>
<hr>
<p>The issue arises from transferring a JSON string that has been altered by changing double-quotes to single-quotes. The solution is to revert these changes:</p>
<pre><code>hash = JSON[str]
JSON[hash['data'].tr("'", '"')]
# => [{"Docket Type"=>"MOT - MOTION",
# "Filing Date"=>"19-AUG-2015",
# "Filing Party"=>"PNC BANK, NATIONAL ASSOCIATION,",
# "Docket Text"=>
# "TO GRANT WRIT OF POSSESSION FOR FAILURE TO VACATE PREMISES FB PLT, PNC BANK"},
# {"Docket Type"=>"AFF - AFFIDAVIT",
# "Filing Date"=>"19-AUG-2015",
# "Filing Party"=>" ",
# "Docket Text"=>
# "PURSUANT TO SECTION 83.561, FLORIDA STATUTES FB PLT, PNC"},
# {"Docket Type"=>"108FF - CAFF/REOPEN ($50.00)",
# "Filing Date"=>"19-AUG-2015",
# "Filing Party"=>" ",
# "Docket Text"=>"<i>none.</i>"},
# {"Docket Type"=>"RO - REOPEN",
# "Filing Date"=>"19-AUG-2015",
# "Filing Party"=>" ",
# "Docket Text"=>"<i>none.</i>"},
# {"Docket Type"=>"COS - CERTIFICATE OF SERVICE",
# "Filing Date"=>...
<p>It's crucial for JSON data to adhere to <a href="http://json.org" rel="nofollow">the specified guidelines</a>. Strings need to be enclosed in double-quotes:</p>
<blockquote>
<p>A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.</p>
</blockquote>
<p>The practice of encoding JSON within JSON can lead to challenges and potential data corruption. Base64 encoding could be a more reliable approach to ensure data integrity during transfer.</p>
<p>An alternative method involves letting the JSON parser handle the serialization with escaped characters:</p>
<pre><code>require 'json'
foo = JSON[{'a' => 'b'}]
JSON[ {'bar' => foo }] # => "{\"bar\":\"{\\\"a\\\":\\\"b\\\"}\"}"
This process simplifies data retrieval:
JSON[bar] # => {"bar"=>"{\"a\":\"b\"}"}
JSON[bar]['bar'] # => "{\"a\":\"b\"}"
JSON[bar]['bar']['a'] # => "a"
Repeating decoding steps can complicate the process. It's essential to minimize such complexities to maintain data integrity during transmission.