Hi Waruna,

I believe you may be able to do a json to yaml conversion using
SnakeYaml[1] in Java, assuming there is a mechanism in place to validate a
yaml payload against a yaml schema.

Furthermore, the lib has Apache 2.0 licences.

Code :

private static String convertToJson(String yamlString) {
    Yaml yaml= new Yaml();
    Map<String,Object> map= (Map<String, Object>) yaml.load(yamlString);

    JSONObject jsonObject=new JSONObject(map);
    return jsonObject.toString();}

Source : http://stackoverflow.com/a/23774617

[1] - https://code.google.com/archive/p/snakeyaml/


Thanks and Regards,

Ruwan Yatawara

Senior Software Engineer,
WSO2 Inc.

email : ruw...@wso2.com
mobile : +94 77 9110413
blog : http://ruwansrants.blogspot.com/
www: :http://wso2.com


On Mon, Mar 21, 2016 at 12:03 PM, Waruna Perera <waru...@wso2.com> wrote:

> Hi,
>
> Has some one done a similar sort of thing with JAVA? If so please give me
> a good library you have used.
>
> Thanks,
>
> Waruna
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to