Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

extractJsonPaths failed to extract value with special char

extractJsonPaths failed to extract value with special char

New Contributor

Hi.

 

I have a question regarding the extractJsonPaths command.

 

I have the following Json object.

 

{
"message": "64.242.88.10 - - [07/Mar/2004:16:05:49 -0800] \"GET /twiki/bin/edit/Main/Double_bounce_sender?topicparent=Main.ConfigurationVariables HTTP/1.1\" 401 12846\r",
"@timestamp": "2016-01-07T15:23:16.263Z",
"host": "localhost.localdom",
"TZ": "UTC"
}

 

I am trying to extract the values with the following conf:

 

morphlines : [
{
id : default
importCommands : ["org.kitesdk.**"]

commands : [
{ readJson {} }

{ extractJsonPaths {
flatten : false
paths : {
host : "/host"
timestamp : "/@timestamp"
msg : "/message"
timezone : "/TZ"
}
}
}
]
}
]

 

The message field is problemtic because it includes extra quatation marks, even though they are backslashed.

Does anyone know how to overcome this?

1 REPLY 1

Re: extractJsonPaths failed to extract value with special char

New Contributor

Hi, 

Are you able to resovle this now ? 

I am trying smae thing with simple json file having only one element but it's not able to parse and getting bellow

 

Error:

 

Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character (':' (code 58)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')