Stream Erichment : Invalid JSON


#1

Dear All,

Please suggest on the below issue.

I am using snowplow stream enrichment for enrich process.

As per the instruction given on

i have installed and configured the stream enrichment.(resolver.json file as well)

After installation i am running below command as given for execution

$ java -jar snowplow-stream-enrich-0.13.0.jar --config my.conf --resolver file:resolver.json

but when i am running above command it is throwing me below error.(Invalid JSON in resolver.json file)

though i already have validated this JSON file with available JSON validator as well for it’s correctness and it is valid there.

Please find the below Resolver.json content

Even though to just make it sure , instead of resolver.json file content , i simply removed the whole content and just kept curly braces open and closed, if there would be any content issue in resolver.json.

despite that as well ,it is showing the same error.

Can anyone please suggest for this issue.


#2

Can you post your JSON file (text) - it’s hard to debug with a screenshot :slight_smile:


#3

thanks for your heads up @premjg .

Here’s my JSON text

{
“schema”: “iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1”,
“data”: {
“cacheSize”: 500,
“repositories”: [
{
“name”: “Iglu Central”,
“priority”: 0,
“vendorPrefixes”: [ “com.snowplowanalytics” ],
“connection”: {
“http”: {
“uri”: “http://iglucentral.com
}
}
}
]
}
}


#4

@miteshu, you use invalid quotes, and , which are hard to spot without using a linting tool. They could have been introduced by your editor. Below is the correct JSON. Do beware that copying and pasting could break it by the editor you use. You might want to check its settings or use a different editor.

{
  "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1",
  "data": {
    "cacheSize": 500,
    "repositories": [
      {
        "name": "Iglu Central",
        "priority": 0,
        "vendorPrefixes": [
          "com.snowplowanalytics"
        ],
        "connection": {
          "http": {
            "uri": "http://iglucentral.com"
          }
        }
      }
    ]
  }
}

Here’s an online lining tool you could use: http://zaa.ch/jsonlint/


#5

Thanks a lot @ihor for the solution.

As per your suggestion , i agree and can clearly see my above pasted json is seems to be invalid on http://zaa.ch/jsonlint.

Even though , i am now using your corrected JSON now ,but it still showing the same error.

Below is your corrected JSON i used.

{
“schema”: “iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1”,
“data”: {
“cacheSize”: 500,
“repositories”: [
{
“name”: “Iglu Central”,
“priority”: 0,
“vendorPrefixes”: [
“com.snowplowanalytics”
],
“connection”: {
“http”: {
“uri”: “http://iglucentral.com
}
}
}
]
}
}

I further played with this JSON and observed some behavior.

The reason why my earlier pasted JSON was showing error , is because , when we directly copy this JSON text from browser and try to validate then browser appends some character and due to which it shows below error.

Instead of this , if we directly copy this from our text editor then , it doesn’t show this error and says…JSON is valid

In this above both the scenario’s , i used your given corrected JSON only.


#6

@ihor

Could you please email me that corrected JSON file , so that instead of directly copying it from browser ,i can use that file as it is.

Here’s my email Id : miteshu@cybage.com

Once again, i would be thankful of yours, if you can email that file , so that i can proceed further.

Also i would also like to update you that since this is the JSON issue, so just to cross check our content i just placed an empty file which doesn’t have any content inside it and it just have open and close curly braces.
like below

{

}

atleast above JSON file shouldn’t be giving JSON related error, but despite keeping like this , still i am facing the same issue.


#7

Hello All,
I am also facing the same issue. After running jar following error appears

Exception in thread “main” java.lang.RuntimeException: Field []: invalid JSON

Please suggest regarding the same.