in reply to Outputting JSON with function () {...} values

Seems like I misunderstood the direction of your process.

you want to create "pseudo" JSON from Perl with a JSON library.

There is a possibility to allow Perl objects to return a scalar, but I doubt it's possible to be js code instead of a string.

See https://metacpan.org/pod/JSON#OBJECT-SERIALISATION

I see 3 possibilities:

HTH

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re: Outputting JSON with function () {...} values

Replies are listed 'Best First'.
Re^2: Outputting JSON with function () {...} values
by cosmicperl (Chaplain) on Oct 22, 2018 at 20:25 UTC

    Yes that's correct. Regexp'ing afterwords was where I thought I'd end up and this has confirmed it. I can't change to "legal JSON" as the output if for a JS plugin and I don't want to start hacking at that and break future upgrades.

      It's not trivial if the code contains double quotes and you do it on the Perl side.

      Post processing in JS should be easier.

      > and this has confirmed it.

      Please don't consider my opinion as the only possible.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice