1
Serializing liquid xml object into Json
Question asked by Sivaprasath MANIVANNAN - 10/10/2022 at 11:58 AM
Answered

8 Replies

Reply to Thread
0
Liquid Support Replied
Employee Post
Do you have a specific issue?

For an overview, please see the online tutorial 'Using JSON with Liquid XML Objects':
0
The content of my original post somehow disappeared. Here is my question.

I am working on a project that involves round trip conversion between xml and json by using liquid generated C# objects as intermediaries. As a first step, I ran a simple test in which I convert the default liquid xml object into json and it fails. Below is a snapshot of the code and the exception. 

I appreciate your help in solving this issue.


0
Liquid Support Replied
Employee Post
In the Generated code you should see a class named 'LxRuntimeRequirementsWritten' this should have the  class attribute 'LxRuntimeRequirements'.

Did you enter a Trial license key in the license dialog when you generated the code?


0
Thanks for the reply. I do not see the LxRuntimeRequirementsWritten class in the generated code. 

We have an active Liquid xml license. Below are snapshots of the license manager and the list of liquid generated classes. Please let me know if you need any further information.


0
Liquid Support Replied
Employee Post
It looks like you have used the legacy 'Liquid XML Data Binder' option to generate the C# code and are now trying to use that with the 'Liquid XML Objects' Runtime.

Please delete the output folder and start again.

1. Run Liquid XML Data Binder.
2. Select 'Create a New Wizard Project. Click Next.
3. Select Output Language as C# and 'Liquid XML Objects' as the code generator to use.

Then add your schema and generate the code.

Note you can also do this from within Visual Studio, please see the Quick Start Guide:

0
Thanks for the response. Seems like we are getting closer to resolving this issue.
We build the dll with Liquid C# objects in the TeamCity via a build script. I believe it is the following lines in our build script that need to be modified to do what you suggested. Can you please provide the equivalent command to do what you proposed?

    try
    {
        $command = Get-Command LXDB19.exe -ErrorAction Stop
        $lxbd17_app = $command.Path
    }
    catch
    {    
    }    
 
    Set-Alias Lxbd12 $lxbd17_app
    if ($quiet)
    {
        Lxbd12 /Project $project_path /S | Out-Null
    }
    else
    {
        Lxbd12 /Project $project_path /V
    }
0
Liquid Support Replied
Employee Post Marked As Answer
OK, It looks like you have used the XML Data Binder (XDB) for quite some time? If this is the case you may not want to move to Liquid XML Objects (LXO) as you may have legacy code which relies on the XDB object model?

XML / JSON roundtrip is supported in the legacy XDB codebase using the ToJson/FromJson methods as described here:

If you do not have a legacy issue, Liquid XML Objects is a more advanced technology and we would recommend migrating to it. You can call LXO from the command line as described here:

0
Yes, this is a legacy code generated using XML Data Binder. We will consider using Liquid XML Objects for any new code. Thanks for your help.

Reply to Thread