>From what I'm seeing so far, I can't convert a leaf node into a JSON string. 
>The only entities I can convert are container or list.
Is this correct?

I got this from:
    private SchemaTracker(final SchemaContext context, final SchemaPath path) {
        SchemaNode current = SchemaUtils.findParentSchemaOnPath(context, path);
        Preconditions.checkArgument(current instanceof 
DataNodeContainer,"Schema path must point to container or list or an rpc 
input/output. Supplied path %s pointed to: %s",path,current);
        root = (DataNodeContainer) current;
    }

When trying to create JSONNormalizedNodeStreamWriter

-----Original Message-----
From: Robert Varga [mailto:n...@hq.sk] 
Sent: Sunday, July 24, 2016 4:52 PM
To: Sela, Guy <guy.s...@hpe.com>; controller-dev@lists.opendaylight.org; 
mdsal-...@lists.opendaylight.org
Subject: Re: [mdsal-dev] Serialize/Deserialize DTOs to JSON

On 07/24/2016 01:36 PM, Sela, Guy wrote:
> Hi,
> 
> Is there an API that I can call which gets a DataObject as input and 
> returns a JSON representation of it?

Not directly, as DataObject and related generated code is an access facade. 
Primary data representation is NormalizedNode, hence you need to transform the 
DTOs to NormalizedNodes (see mdsal-binding-dom-codec) and then use 
yang-data-codec-gson (or -xml) to get the representation you seek.

I think TTPUtils (in TTP) does exactly that.

Bye,
Robert

_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to