To me, too many!
The solution to this problem is to update the registry telling IE that for docs that have a mime type of application/json, just view it in place. This won't affect any application/json documents downloaded via
script
tags, or via XHR, and so on.How it works
Stop IE. Then, cut and paste the following into a file, by the name ofjson.reg.
Windows Registry Editor Version 5.00
;
; Tell IE to open JSON documents in the browser.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
Then double-click the .reg file and restart IE. Eventually the response you will have for Content-Type: application/json or Content-Type: text/json will be correct.
{
"OutcomeType": 0,
"Message": null,
"Exception": null,
"Value": {
"Detail": {
"EquipmentCode": null,
"DocumentNumber": "1245",
"PurchaseCustomerNumber": "quote",
"OrderReason": 0,
"CreationDate": "2014-10-31",
"StartValidityDate": null,
"EndValidityDate": null,
"Value": 0,
"Currency": null,
"Approved": 1
},
"Items": [
{
"PositionNumber": "000010",
"MaterialCode": "4355656",
"Description": "Item 1",
"TotalAmount": 12,
"SchedulDate": null,
"ShippedAmount": 0,
"BilledAmount": 0,
"NetValue": 96.48,
"GrossValue": 100.44,
"Currency": "EUR",
"SalesUnit": null
}
]
}
}
For Chrome and FF it is more simple: just download the add-on JSON Viewer!
FF: https://addons.mozilla.org/it/firefox/addon/jsonview/
Chrome: https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh
Enjoy!
Nessun commento:
Posta un commento