| 1 | package CSAF::Renderer::JSON; | ||
| 2 | |||
| 3 | use 5.010001; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use utf8; | ||
| 7 | |||
| 8 | use Cpanel::JSON::XS; | ||
| 9 | |||
| 10 | use Moo; | ||
| 11 | extends 'CSAF::Renderer::Base'; | ||
| 12 | |||
| 13 | sub render { | ||
| 14 | |||
| 15 | my $json = Cpanel::JSON::XS->new->utf8->canonical->allow_nonref->allow_unknown->allow_blessed->convert_blessed | ||
| 16 | ->stringify_infnan->escape_slash(0)->allow_dupkeys->pretty->space_before(0); | ||
| 17 | |||
| 18 | my $csaf = shift->csaf->build; | ||
| 19 | my $json_string = $json->encode($csaf); | ||
| 20 | |||
| 21 | return $json_string; | ||
| 22 | |||
| 23 | } | ||
| 24 | |||
| 25 | 1; | ||
| 26 | |||
| 27 | |||
| 28 | __END__ |