1Search::Elasticsearch::URsoelre:C:oSnetSrreiiaabrlucithze:ed:rE:Pl:eaJrsSltOiNDc(os3ce)uamrecnht:a:tRioolne::Serializer::JSON(3)
2
3
4
6 Search::Elasticsearch::Role::Serializer::JSON - A Serializer role for
7 JSON modules
8
10 version 7.30
11
13 This role encodes Perl data structures into JSON strings, and decodes
14 JSON strings into Perl data structures.
15
17 "encode()"
18 $bytes = $serializer->encode($ref);
19 $bytes = $serializer->encode($str);
20
21 The "encode()" method converts array and hash refs into their JSON
22 equivalents. If a string is passed in, it is returned as the UTF8
23 encoded version of itself. The empty string and "undef" are returned
24 as is.
25
26 "encode_pretty()"
27 $bytes = $serializer->encode_pretty($ref);
28 $bytes = $serializer->encode_pretty($str);
29
30 Works exactly as "encode()" but the JSON output is pretty-printed.
31
32 "encode_bulk()"
33 $bytes = $serializer->encode_bulk([\%hash,\%hash,...]);
34 $bytes = $serializer->encode_bulk([$str,$str,...]);
35
36 The "encode_bulk()" method expects an array ref of hashes or strings.
37 Each hash or string is processed by "encode()" then joined together by
38 newline characters, with a final newline character appended to the end.
39 This is the special JSON format used for bulk requests.
40
41 "decode()"
42 $var = $serializer->decode($json_bytes);
43 $str = $serializer->decode($bytes);
44
45 If the passed in value looks like JSON (ie starts with a "{" or "["
46 character), then it is decoded from JSON, otherwise it is returned as
47 the UTF8 decoded version of itself. The empty string and "undef" are
48 returned as is.
49
51 Enrico Zimuel <enrico.zimuel@elastic.co>
52
54 This software is Copyright (c) 2020 by Elasticsearch BV.
55
56 This is free software, licensed under:
57
58 The Apache License, Version 2.0, January 2004
59
60
61
62perl v5.32.1 Sear2c0h2:1:-E0l1a-s2t7icsearch::Role::Serializer::JSON(3)