JSON highlighter breaking on date strings #83

Closed
ianstormtaylor opened this Issue Oct 3, 2012 · 2 comments

Comments

Projects
None yet
2 participants

This doesn't work:

{
    "apiKey" : "YOUR_TEST_OR_LIVE_KEY",
    "batch"  : [
        {
            "method"    : "identify",
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "sessionId" : "fj2hvu328vh38uvh83kxjf",
            "userId"    : "friends@segment.io",
            "traits"    : {
                "Subscription Plan" : "Gold",
                "Friend Count"      : 42
            }
        },
        {
            "method"    : "track",
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "sessionId" : "fj2hvu328vh38uvh83kxjf",
            "userId"    : "friends@segment.io",
            "event"     : "Played a Song",
            "properties" : {
                "genre"  : "Hip Hop",
                "artist" : "Theophilus London"
            }
        }
    ]
}

But remove some properties from the second object and it does work again:

{
    "apiKey" : "YOUR_TEST_OR_LIVE_KEY",
    "batch"  : [
        {
            "method"    : "identify",
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "sessionId" : "fj2hvu328vh38uvh83kxjf",
            "userId"    : "friends@segment.io",
            "traits"    : {
                "Subscription Plan" : "Gold",
                "Friend Count"      : 42
            }
        },
        {
            "method"    : "track",
            "event"     : "Played a Song",
            "properties" : {
                "genre"  : "Hip Hop",
                "artist" : "Theophilus London"
            }
        }
    ]
}

This doesn't work:

{
    "apiKey" : "YOUR_TEST_OR_LIVE_KEY",
    "batch"  : [
        {
            "method"    : "identify",
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "traits"    : {
                "Subscription Plan" : "Gold",
                "Friend Count"      : 42
            }
        },
        {
            "method"    : "track",
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "properties" : {
                "genre"  : "Hip Hop",
                "artist" : "Theophilus London"
            }
        }
    ]
}

But when I remove the "method" it does work again even with two date strings:

{
    "apiKey" : "YOUR_TEST_OR_LIVE_KEY",
    "batch"  : [
        {
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "traits"    : {
                "Subscription Plan" : "Gold",
                "Friend Count"      : 42
            }
        },
        {
            "timestamp" : "Mon Apr 16 2012 14:21:48 GMT-0400 (EDT)",
            "properties" : {
                "genre"  : "Hip Hop",
                "artist" : "Theophilus London"
            }
        }
    ]
}
Owner

ccampbell commented Oct 4, 2012

I am not able to reproduce this. I put together a demo page:
http://craig.is/assets/json-test/index.html

Can you provide a demo page where this is happening?

Sorry for the long delay, realized it was completely my fault. Didn't realize that Rainbow is automatically called on page load, so I had to edit the source to remove that call.

Might be something you don't want to make automatic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment