NAME

Langertha::Role::JSON - Role for JSON

VERSION

version 0.500

decode_json_text

my $data = $engine->decode_json_text($perl_string);

Decodes a JSON string that is already a Perl-Unicode string (e.g. a value pulled out of an already-decoded response tree, or a substring extracted from assistant-produced text). The shared JSON::MaybeXS instance is configured with utf8 => 1 and expects raw bytes, so this helper UTF-8-encodes the text before delegating to it. Use this instead of $self->json->decode whenever the source is Perl-Unicode rather than the raw HTTP body.

json

my $data = $engine->json->decode($json_string);
my $json_string = $engine->json->encode($data);

Returns the shared JSON::MaybeXS instance configured with utf8 and canonical encoding. Used internally by Langertha::Role::HTTP and Langertha::Role::Streaming for all JSON serialization.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.