JSON Parser

LogViewPlus has a built in JSON parser which is capable of analyzing your JSON log files. It does this by parsing your JSON file according to a template. A template is a sample JSON log entry that has certain fields identified with Conversion Specifiers.

Let's look at a simple JSON example:





"other":"ignore me",

"dateJoined":"2014-05-16 10:50:14,125"


This is a JSON log entry with five fields: firstName, lastName, employeedId, other, and dateJoined. What we need to do is replace the field data with a Conversion Specifier that identifies the field data type. This might give us the following mapping.

JSON Field
Conversion Specifier
LogViewPlus Column
%S{First Name}
First Name
%S{Last Name}
Last Name
%s{Employee Id}
Employee Id
We want to ignore this field.
Date and Time

Therefore, we could parse this JSON log entry with the template:


"firstName":"%S{First Name}",

"lastName":"%S{Last Name}",

"employeeId":"%s{Employee Id}",



Notice that in the above template the "other" field has been ignored. To ignore a field we simply do not include it in our template. If one of the elements we were interested in had been a child of a parent node, we would have needed to include the parent node in our template. The important thing is that the template has the full path to the target node.

Once we load this template into LogViewPlus it will appear as:

To do this, we just need to give LogViewPlus our parsing template as an argument for the JSON parser. We can do this in Parser Mappings:

Whitespace will be ignored, so we are free to format the JSON as needed.

Log files parsed with the JSON parser support automatic pretty-printing.

Finally, notice the similarities between the JSON Parser and the XML Parser discussed in the next section. Both use the concept of templates, so once you have learned one you have basically learned the other.

< >