Chrome Dev Tools XHR preview tab is unformatted

8 views
Skip to first unread message

Ian Rr

unread,
Oct 1, 2015, 1:38:41 PM10/1/15
to pd...@googlegroups.com

Hey all!  

I probably should have taken this issue to Google a month ago but I'm gonna run it past you all first just in case.  Plus, I like this group.

I work on a project where somebody else is handling the PHP backend sending me JSON. 

Now... you know how under the "Network" tab in DevTools there's the "Headers" and the "Preview" and the "Response" where the latter two are the same data, but the "Preview" is formatted.

Recently, some (but not all) of the data returned comes through and is NOT formatted under the preview tab.  It look just like the response tab.

This has been a real pain, especially considering that the backend specializes in overly-complex objects with tons of superfluous data -- lately I've been pasting it into a separate Lint window to format it.

I've been unable to discover a difference between the calls that WILL return formatted previews and those that won't.  Both are valid JSON.  Response headers all seem normal.

I've been trying to work with the backend guy to figure it out but he's... not very helpful, doesn't care about front end concerns, is about 14 months behind his deadlines, kinda sucks, etc.

Anybody ever had this problem??  I swear it's slowly killing me.

Thanks in advance!
Ian R

p.s.  thanks to everybody who helped out with my Portland office concerns -- but I ended up moving to Seaside!   Does the ocean have wi-fi?

Sean Adkinson

unread,
Oct 1, 2015, 2:02:57 PM10/1/15
to pd...@googlegroups.com
Would've expect it to be a header issue.  Make sure `Content-Type: application/json` is present.

It could also be invalid JSON perhaps?  Are all the keys wrapped in double-quotes?  If you paste the contents into a JSON parser, does it come back okay?

Perhaps you could post some screenshots or actual data to help diagnose.

Best of luck,
Sean


--
You received this message because you are subscribed to the Google Groups "Portland JavaScript Admirers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdxjs+un...@googlegroups.com.
To post to this group, send email to pd...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdxjs/CAKct3PyaEo2P1VMPpzeBdHsSDm%2B0mA2rG%2BhN6KqK2B0LiUeH0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

Ian Rr

unread,
Oct 1, 2015, 2:25:11 PM10/1/15
to pd...@googlegroups.com

Sure, why not?  Don't tell my boss though.  Like I said -- huge huge objects, lots of superfluous data.  I almost wonder if there's a KB limit for previewing??  But probably not because this has only been the case for a month or so.

Unfortunately, both formatted and unformatted responses are valid JSON, double-quotes and everything, and both have the correct response header.  What I've pasted below has been run through and approved by jsonlint.com.

Anyway, for the very unfaint-of-heart...

Here's one that is coming through formatted:

  1. cache-control:
    no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  2. content-type:
    application/json; charset=UTF-8
  3. date:
    Thu, 01 Oct 2015 18:01:44 GMT
  4. expires:
    Thu, 19 Nov 1981 08:52:00 GMT
  5. pragma:
    no-cache
  6. server:
    nginx/1.8.0
  7. status:
    200 OK
  8. vary:
    Accept-Encoding
  9. version:
    HTTP/1.1
  10. x-robots-tag:
    noindex

{
    "data": {
        "id": "b87e4787-2a89-942b-66f6-560c3f08ad4c",
        "name": "Dr. Ian Testingtons",
        "contactFirstName": "Dr. Ian",
        "contactLastName": "Testingtons",
        "email": "te...@bxp.huh",
        "phone1": "",
        "phone1Extension": "",
        "phone2": "",
        "phone2Extension": "",
        "taxExempt": 0,
        "hasTerms": false,
        "paymentTerms": "PREPAID",
        "twitterId": "",
        "facebookPage": "",
        "website": "",
        "customDealer": false,
        "hasMapLocations": false,
        "locations": [],
        "defaultBillingLocationId": null,
        "defaultShippingLocationId": null,
        "accountfilters": [],
    },
    "messages": []
}





And here's one that isn't:

  1. cache-control:
    no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  2. content-type:
    application/json; charset=UTF-8
  3. date:
    Thu, 01 Oct 2015 18:01:46 GMT
  4. expires:
    Thu, 19 Nov 1981 08:52:00 GMT
  5. pragma:
    no-cache
  6. server:
    nginx/1.8.0
  7. status:
    200 OK
  8. vary:
    Accept-Encoding
  9. version:
    HTTP/1.1
  10. x-robots-tag:
    noindex




{
    "data": {
        "id": "97f025c7-082a-921a-2f98-560c4085fda8",
        "nickname": "Studio",
        "saved": false,
        "savedQuoteId": null,
        "accountId": "b87e4787-2a89-942b-66f6-560c3f08ad4c",
        "hasOwnership": true,
        "revised": false,
        "expirationDate": "2015-12-29 20:44:21",
        "price": 2155,
        "rushService": false,
        "designConsultation": false,
        "designVariationId": 23777,
        "designName": "Studio",
        "designerName": "Lindsy Talarico",
        "designSlug": "studio",
        "quoteURL": "/designs/studio/quote/23777/",
        "defaultQty": 100,
        "pieces": [
            {
                "id": "6f6471d6-2ab2-d8e1-d61b-560c402a3147",
                "qty": 100,
                "price": 895,
                "_piecePostName": "invitation",
                "pieceId": 1270,
                "paperId": 1135,
                "sizeId": 1255,
                "shapeId": 114,
                "nickname": "",
                "parentPieceId": null,
                "grommeting": false,
                "edgePainting": "34-1051",
                "calligraphyLines": 0,
                "calligraphyMonogram": false,
                "faceColors": [
                    {
                        "pmcId": "33-1051",
                        "locked": false
                    },
                    {
                        "pmcId": "33-1061",
                        "locked": false
                    }
                ],
                "backColors": [],
                "ecoSpecsMsg": false,
                "_availablePapers": [
                    "1221",
                    "1135",
                    "4555",
                    "4565",
                    "23935",
                    "23938",
                    "23940",
                    "23943"
                ],
                "_availableSizes": [
                    "1254",
                    "1255",
                    "1258",
                    "1256",
                    "1263"
                ],
                "_availableShapes": [
                    "114",
                    "189",
                    "116",
                    "115"
                ],
                "_availableCustomPrintMethods": [
                    "33",
                    "37"
                ],
                "_availableEdgingPrintMethods": [
                    "34",
                    "1625"
                ],
                "_availableDependentPieces": [
                    "1281",
                    "1293"
                ],
                "priceLines": [
                    {
                        "_plTitle": "Quantity / Stock",
                        "_plText": "100 pieces on F-8 Bella Cotton 1 ply - White",
                        "_plAmount": 315
                    },
                    {
                        "_plTitle": "Custom Printing",
                        "_plText": "Letterpress Sea Mist & Mustard",
                        "_plAmount": 440
                    },
                    {
                        "_plTitle": "Edge Painting",
                        "_plText": "Sea Mist Edge Paint",
                        "_plAmount": 140
                    }
                ]
            },
            {
                "id": "af33e7b0-9312-6a5b-2f6f-560c4045772a",
                "qty": 100,
                "price": 320,
                "_piecePostName": "outer invitation envelope",
                "pieceId": 1280,
                "paperId": 1230,
                "sizeId": 1514,
                "shapeId": 1621,
                "nickname": "",
                "parentPieceId": "6f6471d6-2ab2-d8e1-d61b-560c402a3147",
                "faceColors": [],
                "backColors": [],
                "envLiningType": "printed",
                "envLiningPaperId": "1230",
                "envLiningPatternId": "24738",
                "envLiningColors": [
                    {
                        "pmcId": "1630-1061",
                        "locked": false
                    }
                ],
                "_availablePapers": [
                    "1230",
                    "3497",
                    "3499",
                    "18267",
                    "18268",
                    "4573"
                ],
                "_availableSizes": [
                    "1511",
                    "1514",
                    "1516",
                    "1517",
                    "1522"
                ],
                "_availableShapes": [
                    "1621"
                ],
                "_availableCustomPrintMethods": [
                    "33",
                    "36",
                    "37",
                    "1624"
                ],
                "_availableEnvLiningPrintMethods": [
                    1630,
                    1642
                ],
                "_availableDependentPieces": [
                    "1293",
                    "1281"
                ],
                "priceLines": [
                    {
                        "_plTitle": "Quantity / Stock",
                        "_plText": "100 pieces on F-8 Envelope White Text Weight, Blank (No Printing)",
                        "_plAmount": 100
                    },
                    {
                        "_plTitle": "Envelope Lining",
                        "_plText": "Customized Studio Digitally Printed in Mustard on White Liner",
                        "_plAmount": 220
                    }
                ]
            },
            {
                "id": "5b30cd1e-af44-5951-361e-560c4036aa0f",
                "qty": 100,
                "price": 545,
                "_piecePostName": "reply card",
                "pieceId": 1275,
                "paperId": 1135,
                "sizeId": 1261,
                "shapeId": 114,
                "nickname": "",
                "parentPieceId": null,
                "grommeting": false,
                "edgePainting": "34-1051",
                "calligraphyLines": 0,
                "calligraphyMonogram": false,
                "faceColors": [
                    {
                        "pmcId": "33-1051",
                        "locked": false
                    },
                    {
                        "pmcId": "33-1061",
                        "locked": false
                    }
                ],
                "backColors": [],
                "_availablePapers": [
                    "1135",
                    "1221",
                    "4555",
                    "4565",
                    "23943",
                    "23940",
                    "23938",
                    "23935"
                ],
                "_availableSizes": [
                    "1261",
                    "1260"
                ],
                "_availableShapes": [
                    "114",
                    "189",
                    "116",
                    "115"
                ],
                "_availableCustomPrintMethods": [
                    "33",
                    "37"
                ],
                "_availableEdgingPrintMethods": [
                    "34",
                    "1625"
                ],
                "_availableDependentPieces": [],
                "priceLines": [
                    {
                        "_plTitle": "Quantity / Stock",
                        "_plText": "100 pieces on A-5 Bella Cotton 1 ply - White",
                        "_plAmount": 145
                    },
                    {
                        "_plTitle": "Custom Printing",
                        "_plText": "Letterpress Sea Mist & Mustard",
                        "_plAmount": 260
                    },
                    {
                        "_plTitle": "Edge Painting",
                        "_plText": "Sea Mist Edge Paint",
                        "_plAmount": 140
                    }
                ]
            },
            {
                "id": "67093308-66d8-ef0c-6f74-560c405e281d",
                "qty": 100,
                "price": 295,
                "_piecePostName": "reply card envelope",
                "pieceId": 1282,
                "paperId": 1230,
                "sizeId": 1520,
                "shapeId": 1621,
                "nickname": "",
                "parentPieceId": "5b30cd1e-af44-5951-361e-560c4036aa0f",
                "faceColors": [],
                "backColors": [],
                "envLiningType": "printed",
                "envLiningPaperId": "1230",
                "envLiningPatternId": "24738",
                "envLiningColors": [
                    {
                        "pmcId": "1630-1061",
                        "locked": false
                    }
                ],
                "_availablePapers": [
                    "1230",
                    "4573",
                    "3497",
                    "3499",
                    "18267",
                    "18268"
                ],
                "_availableSizes": [
                    "1520",
                    "1519"
                ],
                "_availableShapes": [
                    "1621"
                ],
                "_availableCustomPrintMethods": [
                    "33",
                    "36",
                    "37",
                    "1624"
                ],
                "_availableEnvLiningPrintMethods": [
                    1630,
                    1642
                ],
                "_availableDependentPieces": [],
                "priceLines": [
                    {
                        "_plTitle": "Quantity / Stock",
                        "_plText": "100 pieces on A-5 Envelope White Text Weight, Blank (No Printing)",
                        "_plAmount": 75
                    },
                    {
                        "_plTitle": "Envelope Lining",
                        "_plText": "Customized Studio Digitally Printed in Mustard on White Liner",
                        "_plAmount": 220
                    }
                ]
            }
        ],
        "promotions": [],
        "priceLines": [
            {
                "_plTitle": "Press Setup",
                "_plText": "2 Letterpress Colors (Sea Mist & Mustard)",
                "_plAmount": 100
            }
        ],
    },
    "messages": []
}



Sorry you asked?  I totes understand.  Thanks though!
Ian

Sean Adkinson

unread,
Oct 1, 2015, 2:42:21 PM10/1/15
to pd...@googlegroups.com
Consistently fails for the same requests?

I just setup these same responses to be returned in our Node app, and both displayed correctly in the Preview tab for me, so it may not be a Chrome issue.

Maybe you have some Chrome plugins that are getting in the way?  Really not sure.

For development, I use Chrome Canary so that my cache and cookies don't mix with my dev stuff.  You might try downloading Canary, and since it will be nice and clean, try these requests again.

Best,
Sean



For more options, visit https://groups.google.com/d/optout.

Paul Jungwirth

unread,
Oct 1, 2015, 2:43:49 PM10/1/15
to pd...@googlegroups.com
Hi Ian,

What are the *request* headers?

If I throw good.json and bad.json behind a web server my Chrome gives me
a Preview tab for each.

Paul


On 10/01/2015 11:24 AM, Ian Rr wrote:
>
> Sure, why not? Don't tell my boss though. Like I said -- huge huge
> objects, lots of superfluous data. I almost wonder if there's a KB
> limit for previewing?? But probably not because this has only been the
> case for a month or so.
>
> Unfortunately, both formatted and unformatted responses are valid JSON,
> double-quotes and everything, and both have the correct response
> header. What I've pasted below has been run through and approved by
> jsonlint.com <http://jsonlint.com>.
>
> Anyway, for the very unfaint-of-heart...
>
> Here's one that /is/ coming through formatted:
>
> 1.
> cache-control:
> no-store, no-cache, must-revalidate, post-check=0, pre-check=0
> 2.
> content-type:
> application/json; charset=UTF-8
> 3.
> date:
> Thu, 01 Oct 2015 18:01:44 GMT
> 4.
> expires:
> Thu, 19 Nov 1981 08:52:00 GMT
> 5.
> pragma:
> no-cache
> 6.
> server:
> nginx/1.8.0
> 7.
> status:
> 200 OK
> 8.
> vary:
> Accept-Encoding
> 9.
> version:
> HTTP/1.1
> 10.
> x-robots-tag:
> noindex
>
>
> {
> "data": {
> "id": "b87e4787-2a89-942b-66f6-560c3f08ad4c",
> "name": "Dr. Ian Testingtons",
> "contactFirstName": "Dr. Ian",
> "contactLastName": "Testingtons",
> "email": "te...@bxp.huh",
> "phone1": "",
> "phone1Extension": "",
> "phone2": "",
> "phone2Extension": "",
> "taxExempt": 0,
> "hasTerms": false,
> "paymentTerms": "PREPAID",
> "twitterId": "",
> "facebookPage": "",
> "website": "",
> "customDealer": false,
> "hasMapLocations": false,
> "locations": [],
> "leads":
> "//ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/leads
> <http://ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/leads>",
> "quotes":
> "//ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/quotes
> <http://ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/quotes>",
> "orders":
> "//ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/orders
> <http://ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c/orders>",
> "defaultBillingLocationId": null,
> "defaultShippingLocationId": null,
> "accountfilters": [],
> "self":
> "//ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c
> <http://ian.ordering.bellastationery.com/rest/accounts/b87e4787-2a89-942b-66f6-560c3f08ad4c>"
> },
> "messages": []
> }
>
>
>
>
>
> And here's one that /isn't/:
>
> 1.
> cache-control:
> no-store, no-cache, must-revalidate, post-check=0, pre-check=0
> 2.
> content-type:
> application/json; charset=UTF-8
> 3.
> date:
> Thu, 01 Oct 2015 18:01:46 GMT
> 4.
> expires:
> Thu, 19 Nov 1981 08:52:00 GMT
> 5.
> pragma:
> no-cache
> 6.
> server:
> nginx/1.8.0
> 7.
> status:
> 200 OK
> 8.
> vary:
> Accept-Encoding
> 9.
> version:
> HTTP/1.1
> 10.
> x-robots-tag:
> noindex
>
>
>
>
>
> {
> "data": {
> "id": "97f025c7-082a-921a-2f98-560c4085fda8",
> "nickname": "Studio",
> "saved": false,
> "savedQuoteId": null,
> "accountId": "b87e4787-2a89-942b-66f6-560c3f08ad4c",
> "hasOwnership": true,
> "revised": false,
> "expirationDate": "2015-12-29 20:44:21",
> "price": 2155,
> "rushService": false,
> "designConsultation": false,
> "designVariationId": 23777,
> "designName": "Studio",
> "designerName": "Lindsy Talarico",
> "designSlug": "studio",
> "designerURL":
> "//ian.ordering.bellastationery.com/designers/lindsy
> <http://ian.ordering.bellastationery.com/designers/lindsy>",
> <http://ian.ordering.bellastationery.com/rest/quotes/97f025c7-082a-921a-2f98-560c4085fda8>"
> <mailto:pdxjs+un...@googlegroups.com>.
> To post to this group, send email to pd...@googlegroups.com
> <mailto:pd...@googlegroups.com>.
> <https://groups.google.com/d/msgid/pdxjs/CAKct3PyaEo2P1VMPpzeBdHsSDm%2B0mA2rG%2BhN6KqK2B0LiUeH0g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Sean Adkinson
> (503) 866-0852 <tel:%28503%29%20866-0852> | sean.a...@gmail.com
> <mailto:sean.a...@gmail.com>
> <http://www.linkedin.com/pub/sean-adkinson/4/418/19>
> <https://twitter.com/seanadkinson>
> <https://www.facebook.com/sean.adkinson>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Portland JavaScript Admirers" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to pdxjs+un...@googlegroups.com
> <mailto:pdxjs+un...@googlegroups.com>.
> To post to this group, send email to pd...@googlegroups.com
> <mailto:pd...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pdxjs/CAPT%2BLZxdJ5eM0dBFeurBWJpV%3D5Zph%3Dq_NUFH_-%2BwEoD3n6s64A%40mail.gmail.com
> <https://groups.google.com/d/msgid/pdxjs/CAPT%2BLZxdJ5eM0dBFeurBWJpV%3D5Zph%3Dq_NUFH_-%2BwEoD3n6s64A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Portland JavaScript Admirers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pdxjs+un...@googlegroups.com
> <mailto:pdxjs+un...@googlegroups.com>.
> To post to this group, send email to pd...@googlegroups.com
> <mailto:pd...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pdxjs/CAKct3Pz9Pgrg-1zh2vKE0skUjtkGWy6qcwgBdzEME-QDwkT_wQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/pdxjs/CAKct3Pz9Pgrg-1zh2vKE0skUjtkGWy6qcwgBdzEME-QDwkT_wQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Ian Rr

unread,
Oct 1, 2015, 3:04:08 PM10/1/15
to pd...@googlegroups.com

Crazy!!

Yay, nothing like irreproducible errors.  

The request headers are the same on both calls.

I'm going to try Canary; had forgotten about it.

You guys are awesome.


To unsubscribe from this group and stop receiving emails from it, send an email to pdxjs+un...@googlegroups.com.
To post to this group, send email to pd...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdxjs/560D7ED6.3010808%40gmail.com.

Ian Rr

unread,
Oct 1, 2015, 3:23:56 PM10/1/15
to pd...@googlegroups.com

Oh my god it works in Canary.  

Still don't know what the problem REALLY was -- I don't have much in the way of extensions -- but I'm going to close the JSONlint tab I've had open for 3 weeks.

Thanks all!  For this totally adequate semi-solution!  Not being sarcastic, you know what I mean.

Ian
Reply all
Reply to author
Forward
0 new messages