﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>LogViewPlus Support » LogViewPlus Support » Help &amp; Support  » JSON Parsing Error</title><generator>InstantForum 2017-1 Final</generator><description>LogViewPlus Support</description><link>https://www.logviewplus.com/forum/</link><webMaster>LogViewPlus Support</webMaster><lastBuildDate>Wed, 22 Apr 2026 13:50:01 GMT</lastBuildDate><ttl>20</ttl><item><title>JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1072</link><description>Just sent you an error report generated by LVP when it failed to parse my JSON file.&lt;br/&gt;&lt;br/&gt;I'm guessing the parsing error is happening beause one of the JSON properties contains encoded JSON, which is somehow confusing the parser. The encoded JSON is properly escaped, so it really should be handled the same as any other string value.&lt;br/&gt;&lt;br/&gt;By the way, the reason I'm encoding JSON in a JSON object property is beause I need to log an API response that's sent as JSON. Unfortuntaely, your JSON parser only supports primitives, which kind of defeats the purpose of using JSON. Ideally, I could take the API response and store it as a proper JSON object within a property, instead of having to encode it to a string. </description><pubDate>Sat, 30 Apr 2022 16:23:59 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1427</link><description>Hi AV,&lt;br/&gt;&lt;br/&gt;I investigated this issue today and it is going to be more difficult to resolve than I initially expected.&amp;nbsp; We will not be able to produce a solution in the short term.&lt;br/&gt;&lt;br/&gt;There are two main problems that we have at the moment.&lt;br/&gt;1. The Parse Message command wants to identify other, similar messages in the log file.&amp;nbsp; Dealing with a variable like 'JSON' is too ambiguous.&amp;nbsp; For example, if multiple messages have a lot of differentiation, what would the column headings be?&lt;br/&gt;2. There is a performance impact to parsing JSON (mainly from a memory perspective).&amp;nbsp; LogViewPlus processes messages when the file is parsed.&amp;nbsp; Right now, we don't to take the performance hit of parsing JSON unless we know the user was going to need this feature.&lt;br/&gt;&lt;br/&gt;This is absolutely something that we will be investigating and adding in the future - it is just not something that we can quickly fix.&lt;br/&gt;&lt;br/&gt;For the moment, the best solution I can suggest is to:&lt;br/&gt;1. Manually identify the messages in the log file which are similar.&lt;br/&gt;2. Export those log entries to a new log file.&lt;br/&gt;3. Open the newly created log file.&amp;nbsp; Create a new parser configuration as needed.&lt;br/&gt;&lt;br/&gt;You mentioned "very different objects each time".&amp;nbsp; Because of this, I don't think you will be able to easily solve your problem with a custom parser.&amp;nbsp; All LogViewPlus parsers require a conformity with the logging format.&amp;nbsp; If you have a lot of variability in your messages, this is going to be difficult.&amp;nbsp; Again - what would your column headers be?&amp;nbsp; Also, if your messages were more uniform, you wouldn't need a customer parser - the existing JSON parser would probably work fine.&lt;br/&gt;&lt;br/&gt;Hope that helps,&lt;br/&gt;&lt;br/&gt;Toby&lt;br/&gt;</description><pubDate>Sat, 30 Apr 2022 16:23:59 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1424</link><description>I've got answer to all my questions.&lt;br/&gt;Waiting for BETA.</description><pubDate>Fri, 29 Apr 2022 20:03:18 GMT</pubDate><dc:creator>av2408</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1423</link><description>Thanks a lot.&lt;br/&gt;You are posting answers faster than I am completing questions ) This is amazing responsiveness, thank you.&lt;br/&gt;Just for case, this is the link on the video: &lt;a href="https://youtu.be/M_gcOC3pZr4" id="if_insertedNode_1651261970455"&gt;Parsing json in message&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The question is still actual: can I achieve my result by creating custom parser?&lt;br/&gt;&lt;br/&gt;Just for case, if this my be helpful for your team, here is my case;&lt;br/&gt;i am generating logs from custom script for .Net application (NinjaTrader) with the help of &lt;a href="https://www.newtonsoft.com/json" id="if_insertedNode_1651262256677"&gt;Newtonsoft &lt;/a&gt;json converter and saving them to file using &lt;a href="https://nlog-project.org/" id="if_insertedNode_1651262200586"&gt;NLog&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;And I need to send very different objects each time.&lt;br/&gt;&lt;br/&gt;Thanks again. I am looking forward for BETA.</description><pubDate>Fri, 29 Apr 2022 20:00:48 GMT</pubDate><dc:creator>av2408</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1422</link><description>Please see my comment above.&amp;nbsp; I will take a look at this for the next BETA release.&lt;br/&gt;&lt;br/&gt;This is the only way to parse these fields without creating a custom parser.&amp;nbsp; I can help you with specific questions about LogViewPlus, including creating custom parsers, but I cannot help you create a custom parser.</description><pubDate>Fri, 29 Apr 2022 19:47:36 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1421</link><description>"Parse message" do not extract columns (&lt;br/&gt;Here is the video:&lt;span id="if_insertedNode_1651261361313"&gt;[YouTube]http://www.youtube.com/watch?v=M_gcOC3pZr4[/YouTube]&lt;br/&gt;&lt;br/&gt;Can I extract columns from json without creating custom parser in C#?&lt;br/&gt;Can I extract columns from json by creating custom parser in C#? Will you help me? )&lt;br/&gt;&lt;/span&gt;</description><pubDate>Fri, 29 Apr 2022 19:44:34 GMT</pubDate><dc:creator>av2408</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1420</link><description>We are actively working on making this happen.&amp;nbsp; The Parse Message command outlined above represents our current best efforts on this approach.&amp;nbsp; The next BETA release due out early next week will further enhance our message parsing capabilities.&amp;nbsp;&amp;nbsp;&lt;br/&gt;&lt;br/&gt;Unfortunately, I had a look at our Parse Message unit tests in JSON scenarios and I don't think this is going to work for you at the moment.&amp;nbsp; We currently treat the JSON as one block - which would not be an improvement for you.&amp;nbsp; Let me take a look and see if we can improve things for the next BETA release.</description><pubDate>Fri, 29 Apr 2022 19:40:35 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1419</link><description>Clarification about the question above: may LogViewPlus automatically detect key-value-pairs ? I mean variable number of key-value-pairs of variable types, without a pre-defined set of exact keys/columns?</description><pubDate>Fri, 29 Apr 2022 19:35:57 GMT</pubDate><dc:creator>av2408</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1418</link><description>Hi Andrii,&lt;br/&gt;&lt;br/&gt;Try right clicking on the message and selecting &lt;a href="https://www.logviewplus.com/docs/tools.html" id="if_insertedNode_1651260143979"&gt;Parse Message&lt;/a&gt;:&lt;br/&gt;&lt;img src="../Uploads/Images/84b92bea-b10b-4e49-ad11-bbc1.png" id="if_insertedNode_1651260051809"&gt;&lt;br/&gt;&lt;br/&gt;This doesn't explicitly parse the JSON, but it should get you most of the way there.&amp;nbsp; Alternatively, you can try modifying your parser configuration to provide more detail.&lt;br/&gt;&lt;br/&gt;Hope that helps,&lt;br/&gt;&lt;br/&gt;Toby</description><pubDate>Fri, 29 Apr 2022 19:22:29 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1417</link><description>Hello.&lt;br/&gt;I tried the method Brad provided. &lt;br/&gt;It works fine on my side.&lt;br/&gt;But, entire JSON object still parsed as a text message and placed in a one column.&lt;br/&gt;&amp;nbsp;May I let LogViewPlus to create columns based on json key-value-pairs like on screenshot attached?&lt;img src="../Uploads/Images/ba726863-1de6-4c4d-b59c-d26c.png" data-download-url="../Uploads/Images/8a519e9c-acb7-423d-b790-a7c4.png" id="if_insertedNode_1651259755448"&gt;&lt;br/&gt;&lt;br/&gt;Thank you.&lt;br/&gt;Andrii</description><pubDate>Fri, 29 Apr 2022 19:17:23 GMT</pubDate><dc:creator>av2408</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1148</link><description>I think the issue is that the conversion specifier is expecting a string, so it automatically escapes any quotes within the string. Currently it has no way of knowing that the message field contains JSON.</description><pubDate>Tue, 07 Sep 2021 19:29:27 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1147</link><description>Thanks Brad.&amp;nbsp; I still have this thread on my todo list, but I will take a look at copying the JSON data as well.&lt;br/&gt;&lt;br/&gt;I think the "mj" is implied if you are using the JSON parser.&amp;nbsp; I suspect there is a simple way to display the string without escaping the JSON.</description><pubDate>Tue, 07 Sep 2021 18:10:17 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1146</link><description>Another issue is that it treats the embedded object as a string, so when you copy the contents of the Message column, all the quotes are escaped. I can work around it by copying from the raw log entry in the bottom pane, but that's a pain, because you have to manually figure out the number of indenting levels. Could you add a setting in the conversion specifer syntax, to indicate that a field is a JSON object, not a string? Maybe appending a "j" to the specifier placeholder. For example, instead of %m, you could use %mj.</description><pubDate>Tue, 07 Sep 2021 16:22:12 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1083</link><description>Thanks for bringing this issue to my attention.&amp;nbsp; I can see why this was causing confusion and will take a look for the next release.&amp;nbsp;&amp;nbsp;</description><pubDate>Tue, 03 Aug 2021 13:53:26 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1081</link><description>Yes, I tested it with a property containing an ojbect and it works perfectly. I was confused about this because I couldn't figure out how to get the wizard to accept an object. When I highlighted the object, it said it was not a valid primitive. It would be nice if you could make it so the wizard would accept an object, or at least mention in the error message that you can force it to accept it by making it a string.</description><pubDate>Tue, 03 Aug 2021 13:43:49 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1079</link><description>In general, I agree that the application should not crash like that.&amp;nbsp; However, even more important is that the log file is displayed correctly and no log entries are 'hidden' or 'lost'.&amp;nbsp; In this case, invalid JSON was detected.&amp;nbsp; LogViewPlus tried to recover by reading the next log line and combining it with the (so far) invalid JSON.&amp;nbsp; When this failed, it became impossible for the application to display the file accurately.&amp;nbsp; In this case, I believe a crash is appropriate.&lt;br/&gt;&lt;br/&gt;In the next version of LogViewPlus, we plan to add an option to the JSON parser which allows for 'single line' JSON.&amp;nbsp; If the JSON log entry should exist on a signal line, then the scanning process can be skipped.&amp;nbsp; The JSON is still invalid, but the parser we are introducing in this release should be significantly better at handling invalid JSON.&amp;nbsp; Even if the line cannot be parsed, it can still be combined with another line so that processing can continue.&amp;nbsp; I believe your JSON object is on a single line, so this kind of logic would help.&lt;br/&gt;&lt;br/&gt;To store a JSON object in a property, define your conversion specifier in the usual way:&lt;br/&gt;&lt;span id="if_insertedNode_1627977291510"&gt;[code language="css"]{&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message":"%m"&lt;br/&gt;}[/code]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;This definition can process messages like:&lt;br/&gt;&lt;span id="if_insertedNode_1627977339793"&gt;[code language="css"]{&lt;br/&gt;&amp;nbsp; "message": "Application initializing."&lt;br/&gt;}[/code]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Or:&lt;br/&gt;&lt;span id="if_insertedNode_1627977506151"&gt;[code language="css"]{&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message": { &lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"value1" : "Hello",&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"value2" : "World",&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br/&gt;}[/code]&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;It is necessary for the message field to be a string in the parser configuration (where the conversion specifier is defined).&amp;nbsp; However, the field value can be any JSON type.&amp;nbsp;&amp;nbsp;&lt;br/&gt;&lt;br/&gt;The above JSON will be displayed in LogViewPlus as:&lt;br/&gt;&lt;br/&gt;&lt;img src="../Uploads/Images/77a4c4a8-b0e7-4f47-af7a-5368.png" id="if_insertedNode_1627977564729"&gt;&lt;br/&gt;&lt;br/&gt;Hope that helps,&lt;br/&gt;&lt;br/&gt;Toby&lt;br/&gt;</description><pubDate>Tue, 03 Aug 2021 08:06:20 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1076</link><description>&lt;span id="if_insertedNode_1627941024869"&gt;[quote]Also - it is only the parser definition that must work with JSON primitives.  This is because the conversion specifier is is a string.  There should be no issue with using a conversion specifier to store a JSON object. [/quote]&lt;br/&gt;&lt;br/&gt;Can you elaborate on this?&lt;br/&gt;&lt;br/&gt;How would I go about creating a JSON parser that could store a JSON object in a property, instead of having to convert it to a stirng?&lt;/span&gt;</description><pubDate>Mon, 02 Aug 2021 21:52:38 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1075</link><description>I figured out the problem. There was some non-JSON data on the previous line that shouldn't have been there. Nevertheless, it shouldn't crash like that. I guess the crash is coming from the JSON parser, but it should recover more elgantly like how the other parsers do, and display the dialog where you can edit the template.</description><pubDate>Mon, 02 Aug 2021 21:48:27 GMT</pubDate><dc:creator>SoBeGuy</dc:creator></item><item><title>RE: JSON Parsing Error</title><link>https://www.logviewplus.com/forum/post/1073</link><description>Thanks Brad.&amp;nbsp; I have had a look at the bug report and there is nothing wrong with the JSON line that failed.&amp;nbsp; This is unfortunate as it is going to make the issue harder to track down.&amp;nbsp; The issue seems to be with the prior line.&lt;br/&gt;&lt;br/&gt;What's happening here is that LogViewPlus needs to determine when a full JSON log entry has been read (keeping in mind that JSON may span multiple lines in the log file).&amp;nbsp; This is done prior to JSON parsing.&amp;nbsp; In this case, it is receiving a line of perfectly formatted JSON which cannot be parsed correctly because apparently something in the prior line has confused the pre-scan.&lt;br/&gt;&lt;br/&gt;We have made a lot of JSON changes in this release and plan to make a lot more in the next release.&amp;nbsp; However, in this case, I think this issue would have existed in prior versions as well.&amp;nbsp; There seem to be something in the file, prior to this log line, which is causing the invalid parse.&lt;br/&gt;&lt;br/&gt;I realize this is not always possible, but if you are able to &lt;a href="https://www.logviewplus.com/contact.aspx" id="if_insertedNode_1627938768243"&gt;contact me via email&lt;/a&gt; and send me the log file I can probably get this turned around very quickly.&amp;nbsp; Regardless, I will take a closer look at the pre-scan code to see if I can determine where the error might be.&lt;br/&gt;&lt;br/&gt;Also - it is only the parser definition that must work with JSON primitives.&amp;nbsp; This is because the conversion specifier is is a string.&amp;nbsp; There should be no issue with using a conversion specifier to store a JSON object.&lt;br/&gt;</description><pubDate>Mon, 02 Aug 2021 21:17:59 GMT</pubDate><dc:creator>LogViewPlus Support</dc:creator></item></channel></rss>