Revision 484
- Date:
- 2015/03/05 14:31:55
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/core/comps/contenido/components/inputs/json.msn
57 57 <%once> 58 58 59 59 use JSON::XS; 60 use Data::Recursive::Encode; 60 61 61 62 </%once> 62 63 <%args> … … 67 68 </%args> 68 69 <%init> 69 70 70 $check = html_escape($check) unless $prop->{no_escape}; 71 72 71 if ( ref $check ) { 73 $check = Encode::encode('utf-8', JSON::XS->new->utf8->encode( $check )); 72 $check = Encode::encode('utf-8', JSON::XS->new->encode( Data::Recursive::Encode->decode_utf8($check) )); 74 73 } 74 $check = html_escape($check) unless $prop->{no_escape}; 75 75 76 76 </%init> -
utf8/core/comps/contenido/components/outputs/json.msn
1 1 <%once> 2 2 3 3 use JSON::XS; 4 use Data::Recursive::Encode; 4 5 5 6 </%once> 6 7 <%args> … … 18 19 19 20 my ($prop) = grep { $_->{attr} eq $name } $object->structure; 20 21 my $class = $object->class; 21 my $is_extra = grep { ref $_ && $_->{attr} eq $name } $class->extra_properties ? 1 : 0; 22 my $is_extra = scalar (grep { ref $_ && $_->{attr} eq $name } $class->class_table->required_properties) ? 0 : 1; 22 23 23 24 my $result; 24 25 if ( $is_extra && !$prop->{serialize} ) { 25 eval { $result = JSON::XS->new->decode( $SETS->{$name} ) }; 26 eval { $result = Data::Recursive::Encode->encode_utf8( JSON::XS->new->utf8->decode($SETS->{$name}) ) }; 26 27 } else { 27 28 $result = $SETS->{$name}; 28 29 } 30 warn "\nJSON\n"; 29 31 warn Dumper $result; 30 32 return $result; 31 33