Return Map from Directive?
Net Wolf <[email protected]> Mon, 03 Feb 2020 07:30:50 +0000
| Newsgroups | gmane.comp.jakarta.velocity.user |
|---|---|
| Message-ID | <[email protected]> |
------S283L5KKOAJEK4W1J7GEUSG1FU4LK1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi=2E I'm hoping to extend Velocity to be able to convert a JSON string to a Jav= a Map so that template authors can map values in Velocity=2E Something like: # set mappings =3D JsonToMap ($jsonString) # set username =3D $mappings($userid) I thought I could just write a directive for JsonToMap but directives seem= to return a string rather than a map=2E Alternatively could I add a method in the context somehow? Perhaps I could= then call something like=2E=2E=2E # set username =3D $jsonString=2EtoMap()=2Eget($userid) Sorry if I've misunderstood something fundamental in velocity=2E I'm inter= ested in receiving some guidance on the best way to do this sort of convers= ion=2E Thanks in advance=2E Net Wolf ------S283L5KKOAJEK4W1J7GEUSG1FU4LK1--