JSON Parser Error

asked 2019-04-08 06:39:39 -0500

ankitbeohar90 gravatar image

updated 2019-04-08 11:53:35 -0500

metadaddy gravatar image

I have activemq as a source and json data is populating and want to ingest result in db but while using JSON parser SDC throws error "Unrecognized token 'LT00178': was expecting ('true', 'false' or 'null')".

{
    "billNumber": "LT00178",
    "Id": "3449",
    "": {
        "address1": "bla bla",
        "address2": null,
        "createdAt": 1554290470700,
        "updatedAt": 1554290470700
    },
    "dineInInfo": null,
    "Items": [{
        "categoryId": "155044",
        "categoryName": "Pizza",
        "discountExemptedStatus": false,
        "addons": [{
            "categoryId": "117441",
            "categoryName": "Pizza Topping",
            "createdAt": 1554290470674,
            "updatedAt": 1554290470674
        }, {
            "categoryId": "174530",
            "categoryName": "Pizza Add-On",
            "createdAt": 1554290470675,
            "updatedAt": 1554290470675
        }],
        "itemOffers": [],
        "itemTaxes": [{
            "taxAmount": 1.875,
            "taxId": "0",

        }, {
            "taxAmount": 1.0,
            "taxId": "0",

        }, {
            "taxAmount": 1.875,
            "taxId": "0",

        }],
        "createdAt": 1554290470673,
        "updatedAt": 1554290470673
    }, {
        "categoryId": "174514",
        "categoryName": "Non Veg Pizza",
        "addons": [{
            "categoryId": "117441",
            "categoryName": "Pizza Topping",
            "createdAt": 1554290470681,
            "updatedAt": 1554290470681
        }, {
            "categoryId": "174530",
            "categoryName": "Pizza Add-On",
            "createdAt": 1554290470682,
            "updatedAt": 1554290470682
        }],
        "itemOffers": [],
        "itemTaxes": [{
            "taxAmount": 1.0,
            "taxId": "0",
        }, {
            "taxAmount": 4.8875,
            "taxId": "0",

        }, {
            "taxAmount": 4.8875,
            "taxId": "0",

        }],
        "createdAt": 1554290470680,
        "updatedAt": 1554290470680
    }],
    "Meta": {
        "customerJson": null,
        "offerJson": null,
        "paymentJson": null,
        "taxJson": null,
        "metaJson": "{\"shiftId\":null,\"instanceId\":null,\"appDataRev\":null,\"appVersion\":null,\"tokenNumber\":\"LT-1\",\"rev\":\"6-f4e2a43b2be6eeb514479583146639af\"}",
        "orderJson": null
    },
    "Payments": [{
        "amount": 286.0,
        "comment": null,
        "paymentId": null,
        "paymentInfo": null,
        "paymentMode": "Cash",
        "paymentModeId": 2,
        "paymentVendor": null,
        "paymentStatus": "SUCCESS",
        "paymentTime": 0,
        "createdAt": 1554290470687,
        "updatedAt": 1554290470687
    }],
    "taxes": [{
        "taxAmount": 2.0,
        "taxId": "0",
        "taxName": "Delivery Charge",

    }, {
        "taxAmount": 6.76,
        "taxId": "0",
        "taxName": "CGST",

    }, {
        "taxAmount": 6.76,
        "taxId": "0",
        "taxName": "SGST",

    }],
    "offers": [],
    "States": [{
        "brandUserId": "25408831",
        "state": "CREATED",

    }, {
        "brandUserId": "25408831",
        "state": "PAYMENT_INITIATED",

    }, {
        "brandUserId": "25408831",
        "state": "PENDING",

    }, {
        "brandUserId": "10854040",
        "state": "ACCEPTED",

    }, {
        "brandUserId": "10854040",
        "state": "PREPARED",

    }, {
        "brandUserId": "10854040",
        "state": "DISPATCHED",

    }, {
        "brandUserId": "10854040",
        "state": "DELIVERED",

    }],
    "operationTime": 0
}
edit retag flag offensive close merge delete

Comments

Can you add the full stack trace from sdc.log to your question?

metadaddy gravatar imagemetadaddy ( 2019-04-08 11:55:40 -0500 )edit

Also, did you edit the JSON by hand? There are a lot of extraneous commas. You shouldn't ever have a comma before a closing brace

metadaddy gravatar imagemetadaddy ( 2019-04-08 11:56:43 -0500 )edit

I put JSON parser after JMS consumer but I think if we select json data type in JMS consumer it will automatically handle the rest. I am trying to create fully fledged production ready pipeline lets see how things going.

ankitbeohar90 gravatar imageankitbeohar90 ( 2019-04-08 23:27:43 -0500 )edit