JSON XML parser crashes

fvelo

Silver Partner
Advanced Certified
Joined
Jul 6, 2010
Messages
21
Reaction score
6
Hi, I'm trying to read information off an HTTP Request that returns a JSON Object and for some weird reason the JSON XML Parser wizard is crashing with the following error:

Error executing last component: Newtonsoft.Json.JsonException: Unexpected character while parsing path:
at Newtonsoft.Json.Linq.JsonPath.JPath.ParseMain()
at Newtonsoft.Json.Linq.JsonPath.JPath..ctor(String expression)
at Newtonsoft.Json.Linq.JToken.SelectToken(String path, JsonSelectSettings settings)
at Newtonsoft.Json.Linq.JToken.SelectToken(String path)
at CallFlow.CFD.TextAnalyzerComponent.AnalyzeJSON(Dictionary`2 variableMap)
at CallFlow.CFD.TextAnalyzerComponent.ExecuteStart(Dictionary`2 variableMap)
at CallFlow.CFD.TextAnalyzerComponent.Start(Dictionary`2 variableMap

I've been checking the JSON that gets returned and I'm not finding any weird characters in it, and the parser wizard does read it on the variable mapping part of the box.

here is a sample of what the JSON is:

[{"id":"0","Recibo":"2","Poliza":"1542243788","Ramo":"HOSPITALIZACION CIRUGIA MATERNIDAD","Aseguradora":"Seguros Caracas C.A.","Cedula \/ Rif":"V-00000000","Asegurado":"JOSE MANUEL MARQUINA MARTINEZ","Fecha de nacimiento":"02\/04\/1992","Celular":"0000000000","Correos":"[email protected]","Frecuencia Pago":"Semestral","Desde":"1\/6\/2025","Hasta":"1\/12\/2025","Moneda":"Dolar","Prima":"91,23","script":"1","estado":"0"}]
 
Hi @fvelo,

The error is not with the JSON, but with the path you use to select a node. When you configure this component, you define the mapping of JSON nodes to variables, and when you do this, you specify a path. That path seems to have a wrong character. Can you show how you're configuring this?
 
  • Like
Reactions: Evolute IT
yeah, let me put a screenshot here, I'm using a JSON sample returned from the HTTPRequest response

Capture.PNG
 
Hi,
Can it be something with the name: Dictionary`2


1749573902161.png
 
I believe that's with the internal CFD C# code, there is no data on the JSON with the name Dictionary`2, nor fields, neither values, it would have to be internal C# code generation that's creating that name
 
Do you have a space or any non visible character in any of those 3 paths? You can also check the 3CXCallFlow.log file in verbose mode, just a few lines before the exception, you should have logged the value for the path being searched.
 
apparently it is failing trying to set a specific value:
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Mapping path '[0].Poliza' to variable 'callflow$.contractNumero'
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Variable 'callflow$.contractNumero' set to '1542243788'
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Mapping path '[0].Cedula - Rif' to variable 'callflow$.Cedula'
2025/06/10 15:38:32.306|0013|Erro| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - Dialer - Error executing last component: Newtonsoft.Json.JsonException: Unexpected character while parsing path:
at Newtonsoft.Json.Linq.JsonPath.JPath.ParseMain()
at Newtonsoft.Json.Linq.JsonPath.JPath..ctor(String expression)
at Newtonsoft.Json.Linq.JToken.SelectToken(String path, JsonSelectSettings settings)
at Newtonsoft.Json.Linq.JToken.SelectToken(String path)
at CallFlow.CFD.TextAnalyzerComponent.AnalyzeJSON(Dictionary`2 variableMap)
at CallFlow.CFD.TextAnalyzerComponent.ExecuteStart(Dictionary`2 variableMap)
at CallFlow.CFD.TextAnalyzerComponent.Start(Dictionary`2 variableMap)

from what I can see the variable should receive the value V-00000000 from the JSON, and it's crashing exactly there, but I'm already collecting some dates with - in them without any issues in the same logs :


2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Mapping path '[0].Desde' to variable 'callflow$.fecha'
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Variable 'callflow$.fecha' set to '1-6-2025'
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Mapping path '[0].Hasta' to variable 'callflow$.fechaHasta'
2025/06/10 15:38:32.300|0013|Trac| [_3CX.Script] _900_3.Callflow.11563.[C:3022.2]-DemoDIaler - Dialer 0 - CallFlow.CFD.TextAnalyzerComponent 'JsonXmlParser2' - Variable 'callflow$.fechaHasta' set to '1-12-2025'
 
Hi fvelo
Again, I am not sure, but just reading..

In the log we can see this:
Mapping path '[0].Cedula - Rif' to variable 'callflow$.Cedula'

Where the name 'Cedula - Rif'' get cut off at the space 'Cedula', and then does not match the name anymore.
Could this be the problem, some name with a space dash space ?

Paulo
 
That's correct, [0].Cedula - Rif is not a valid JSON path. Spaces or dashes are not valid as property names.
 
Hi fvelo

Did this information help you get any further? or do you still run into a problem with the CFD and the JSON Parsor?

Paulo
 
Hi, I finished doing some test last night, it was the "-" from the field that was crashing the JSON parser, it's weird but apparently white spaces are allowed but no "-" it seems
 

fvelo

Nice, great to hear it has been resolved !

Paulo
 
  • Like
Reactions: NatalyS_3CX

Latest Posts

Forum statistics

Threads
111,973
Messages
590,075
Members
164,895
Latest member
jasonkkrause