feature request to convert string to JSON

Bug #1637910 reported by Hiroyasu OHYAMA
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
YAQL
Opinion
Undecided
Unassigned

Bug Description

Hi, thank you for providing so exciting software.

In Mistral, I want to get a attribute in a JSON which is STDOUT of a command.
Concretely, I want a method 'toJson' to convert string to JSON like following.

yaql> "{\"foo\":10}".toJson()
{"foo":10}

Surprisingly, YAQL has a mechanism to be extend a new function as following. So I implement that feature for my project.
http://docs.openstack.org/developer/mistral/developer/extending_yaql.html

But, I expect this feature will be used by many cases.
Could you please consider to implement it in YAQL.

Thank you.

Revision history for this message
Stan Lagun (slagun) wrote :

yaql is an open framework which mean that any project hosting yaql (Mistral in your case) can extend it and register additional functions or even drop those bundled with yaql. Default yaql functions are just a standard library, they cannot cover all possible needs. Ability to parse JSON doesn't seem to fit in any of the existing standard library modules. If we implement parseJson, then we will also need to implement dumpJson, which does the opposite. And now there are many libraries to do so, each with different options (formatting, encoding, serialization of non-standard types) etc. And then there be people, who want the same for YAML, XML etc. And then the question would be which library to use for each of them, which version etc. I'd like to keep the list of requirements small. The more dependencies the library has the higher are chances for it to be incompatible with hosting application that wants to use other version of the same library etc.
So let's keep this in Mistral

Changed in yaql:
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.