Parsing yaml files in cloverleaf

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Parsing yaml files in cloverleaf

  • Creator
    Topic
  • #55781
    Pallav Kumar
    Participant

    Does anybody have an experience of parsing & mapping .yaml files in cloverleaf? I googled it and there is java library which can convert .yaml to .json. We can then do the mapping from json to json (or vrl, etc) thru xlate.

    Curious to know if anybody else has done this before?

    Any thoughts are appreciated.

    Thanks,

    Pallav

Viewing 1 reply thread
  • Author
    Replies
    • #86488
      Levy Lazarre
      Participant

      Hello, Pallav

      There is no need to go to Java. There is a “yaml” package in TCL and it’s available to you in Cloverleaf. So you will have to write some TCL code, but you can parse the “.yaml” file either into a TCL dict or TCL huddle. From there, it’s easy to convert to JSON without an Xlate.

      Check the official TCL documentation for examples. Both yaml and huddle are part of Tcllib, which ships with Cloverleaf.

      Code:


      package require yaml
      package require huddle
      ….

      I hope this helps.

    • #86489
      Pallav Kumar
      Participant

      Thanks Levy.. that helps.

      Pallav

Viewing 1 reply thread
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10