TMSFNCWXJSONFormatter with WebCore > strange error

Hi
To test TMSFNCWXJSONFormatter I create a simple project
When I clic a button I add line to it

TMSFNCWXJSONFormatter1.JSON.Add('{"test"="tms software"}');

but an error is displayed but without details

ERROR
Script error. |
at [0:0]

Is this component is webcore compatible ?

Thanks
Sylvain

changing the " = " in the json to a " : " fixes the issue.

TMSFNCWXJSONFormatter1.JSON.Add('{"test":"tms software"}');

Hi
It was an error when I create subject, in fact JSON was well formed

('{"test":"tms software"}');

by adding exception catcher I got an other error with more details

procedure TForm1.WebButton2Click(Sender: TObject);
begin
    Try
     TMSFNCWXJSONFormatter1.JSON.Add('{"test":"tms software"}');
    Except
      ON E:Exception do
      Begin
      End;
    End;
end

ERROR
Uncaught SyntaxError: Unexpected token { in JSON at position 11 | SyntaxError: Unexpected token { in JSON at position 11 at JSON.parse () at Object.ParseJSONValue (http://localhost:8000/ecopdf_client/ecopdf_client.js:37567:16) at Object.ParseJSON (http://localhost:8000/ecopdf_client/ecopdf_client.js:44760:47) at Object.HandlestringChange (http://localhost:8000/ecopdf_client/ecopdf_client.js:75898:54) at Object.cb [as FOnChange] (http://localhost:8000/ecopdf_client/ecopdf_client.js:238:26) at Object.Changed (http://localhost:8000/ecopdf_client/ecopdf_client.js:12285:42) at Object.InsertItem$1 (http://localhost:8000/ecopdf_client/ecopdf_client.js:12346:12) at Object.InsertItem (http://localhost:8000/ecopdf_client/ecopdf_client.js:12336:12) at Object.Add (http://localhost:8000/ecopdf_client/ecopdf_client.js:12378:12) at Object.WebButton2Click (http://localhost:8000/ecopdf_client/ecopdf_client.js:83699:43)
at http://localhost:8000/ecopdf_client/ecopdf_client.js [83703:16]

Before you do this operation, is JSON an empty stringlist?
Did you try to call TMSFNCWXJSONFormatter1.JSON.Clear first?

Updated as recommanded as I'm not sure it is empty

    Try
     TMSFNCWXJSONFormatter1.JSON.Clear;
     TMSFNCWXJSONFormatter1.JSON.Add('{"test":"tms software"}');
    Except
      ON E:Exception do
      Begin
      End;
    End;

Different error with
ERROR
Uncaught ReferenceError: TMSFNCWXJSONFormatter1_idrender is not defined | ReferenceError: TMSFNCWXJSONFormatter1_idrender is not defined at executeScript14A00243B05216EB147688808659E400 (:2:2) at eval (eval at functionFromString (http://localhost:8000/ecopdf_client/ecopdf_client.js:73084:28), :3:32) at mainfunc (http://localhost:8000/ecopdf_client/ecopdf_client.js:73093:24) at Object.ExecuteJavascript (http://localhost:8000/ecopdf_client/ecopdf_client.js:73097:19) at Object.ExecuteJavaScript (http://localhost:8000/ecopdf_client/ecopdf_client.js:626:38) at Object.ExecuteJavaScript (http://localhost:8000/ecopdf_client/ecopdf_client.js:73560:28) at Object.Render (http://localhost:8000/ecopdf_client/ecopdf_client.js:75989:12) at Object.HandlestringChange (http://localhost:8000/ecopdf_client/ecopdf_client.js:75908:43) at Object.cb [as FOnChange] (http://localhost:8000/ecopdf_client/ecopdf_client.js:238:26) at Object.Changed (http://localhost:8000/ecopdf_client/ecopdf_client.js:12285:42)
at http://localhost:8000/ecopdf_client/ecopdf_client.js [83704:16]

We cannot reproduce this issue at our side. I've added your code to a example project and this seems to work fine.

JSONFormatter.zip (6.4 KB)

Hi
Thanks Bradley
I take your project and it works fine

Then I just added a TMSFNCWXPDFViewer component to form and I get the issue I exposed.

S.

JSONFormatter2.zip (7.1 KB)

From other ticket Tünde gave the solution
Adding Wx Component create an empty string inside projet

removing it enable both components to works fine in same form

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.