- foreach my $tag ( @{ $json->{tags} } ) {
- $tag = $tag->{tag};
- warn "# tag $id $tag\n";
- next unless $tag =~ m/#(\d+)/;
- push @{ $ticket_items->{$1} }, $id;
+ $type = $item->{zapi}->{type} = $item->{content}->{$type};
+
+ if ( $type =~ m/json/ ) {
+
+ my $json = $item->{content}->{content};
+ warn "# $json\n";
+ $json = $item->{content} = decode_json $json;
+ warn "# json $id ", dump $json;
+
+ foreach my $tag ( @{ $json->{tags} } ) {
+ $tag = $tag->{tag};
+ warn "# tag $id $tag\n";
+ next unless $tag =~ m/#(\d+)/; # XXX RT number in tag
+ push @{ $ticket_items->{$1} }, $id;
+ }
+
+ } else {
+ warn "ERROR: $type not decoded!";