-
Notifications
You must be signed in to change notification settings - Fork 0
/
json.po
962 lines (816 loc) · 41 KB
/
json.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2022, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Asoul Yang <[email protected]>, 2016
# SkyLull <[email protected]>, 2024
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-09 00:03+0000\n"
"PO-Revision-Date: 2023-08-05 15:25+0800\n"
"Last-Translator: Matt Wang <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.3.2\n"
#: ../../library/json.rst:2
msgid ":mod:`!json` --- JSON encoder and decoder"
msgstr ":mod:`!json` --- JSON 編碼器與解碼器"
#: ../../library/json.rst:10
msgid "**Source code:** :source:`Lib/json/__init__.py`"
msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`"
#: ../../library/json.rst:14
msgid ""
"`JSON (JavaScript Object Notation) <https://json.org>`_, specified by "
":rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 "
"<https://www.ecma-international.org/publications-and-"
"standards/standards/ecma-404/>`_, is a lightweight data interchange format "
"inspired by `JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_ object "
"literal syntax (although it is not a strict subset of JavaScript [#rfc-"
"errata]_ )."
msgstr ""
"`JSON (JavaScript Object Notation) <https://json.org>`_ 是一個輕量化的資料交換格式,在 "
":rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 <https://www.ecma-"
"international.org/publications-and-standards/standards/ecma-404/>`_ "
"裡面有詳細說明,它啟發自 `JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_ "
"的物件字面語法 (object literal syntax)(雖然它並不是 JavaScript 的嚴格子集 [#rfc-errata]_\\ )。"
#: ../../library/json.rst:22
msgid ""
"Be cautious when parsing JSON data from untrusted sources. A malicious JSON "
"string may cause the decoder to consume considerable CPU and memory "
"resources. Limiting the size of data to be parsed is recommended."
msgstr ""
"當剖析無法信任來源的 JSON 資料時要小心。一段惡意的 JSON 字串可能會導致解碼器耗費大量 CPU 與記憶體資源。建議限制剖析資料的大小。"
#: ../../library/json.rst:26
msgid ""
":mod:`json` exposes an API familiar to users of the standard library "
":mod:`marshal` and :mod:`pickle` modules."
msgstr ":mod:`json` 為習慣標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供熟悉的 API。"
#: ../../library/json.rst:29
msgid "Encoding basic Python object hierarchies::"
msgstr "對基本 Python 物件階層進行編碼: ::"
#: ../../library/json.rst:48
msgid "Compact encoding::"
msgstr "改用緊湊型編碼方式::"
#: ../../library/json.rst:54
msgid "Pretty printing::"
msgstr "美化輸出:"
#: ../../library/json.rst:63
msgid "Decoding JSON::"
msgstr "JSON 解碼: ::"
#: ../../library/json.rst:75
msgid "Specializing JSON object decoding::"
msgstr "自訂特殊的 JSON 解碼方式::"
#: ../../library/json.rst:90
msgid "Extending :class:`JSONEncoder`::"
msgstr "在 :class:`JSONEncoder` 裡自行擴充額外的編碼方法::"
#: ../../library/json.rst:108
msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:"
msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化"
#: ../../library/json.rst:119
msgid "See :ref:`json-commandline` for detailed documentation."
msgstr "更詳盡的文件請見 :ref:`json-commandline`。"
#: ../../library/json.rst:123
msgid ""
"JSON is a subset of `YAML <https://yaml.org/>`_ 1.2. The JSON produced by "
"this module's default settings (in particular, the default *separators* "
"value) is also a subset of YAML 1.0 and 1.1. This module can thus also be "
"used as a YAML serializer."
msgstr ""
"JSON 語法是 `YAML <https://yaml.org/>`_ 1.2 語法的一種子集合。所以如果使用預設的設定的話(準確來說,使用預設的 "
"*separators* 分隔符設定的話),這個模組的輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML "
"的串列化工具(serializer)。"
#: ../../library/json.rst:130
msgid ""
"This module's encoders and decoders preserve input and output order by "
"default. Order is only lost if the underlying containers are unordered."
msgstr "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身就是無序的。(例如集合 :class:`set`)"
#: ../../library/json.rst:135
msgid "Basic Usage"
msgstr "基本用法"
#: ../../library/json.rst:142
msgid ""
"Serialize *obj* as a JSON formatted stream to *fp* (a "
"``.write()``-supporting :term:`file-like object`) using this "
":ref:`conversion table <py-to-json-table>`."
msgstr ""
"參考這個\\ :ref:`轉換表 <py-to-json-table>`\\ 將 *obj* 串列化為符合 JSON 格式的字串流,並寫入到 *fp* "
"(一個支援 ``.write()`` 方法的 :term:`file-like object`)"
#: ../../library/json.rst:146
msgid ""
"If *skipkeys* is true (default: ``False``), then dict keys that are not of a"
" basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, "
"``None``) will be skipped instead of raising a :exc:`TypeError`."
msgstr ""
"如果 *skipkeys* 被設為 "
"true(預設值:``False``),那麼非基本型別(:class:`str`,:class:`int`,:class:`float`,:class:`bool`,``None``)的"
" dictionary(字典)鍵值將被略過,而不會引發 :exc:`TypeError`。"
#: ../../library/json.rst:150
msgid ""
"The :mod:`json` module always produces :class:`str` objects, not "
":class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` "
"input."
msgstr ""
":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此,``fp.write()`` "
"必須支援 :class:`str` 的輸入。"
#: ../../library/json.rst:154 ../../library/json.rst:433
msgid ""
"If *ensure_ascii* is true (the default), the output is guaranteed to have "
"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, "
"these characters will be output as-is."
msgstr ""
"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII 字元都會被轉義。若 *ensure_ascii*"
" 為 false,則這些字元將照原樣輸出。"
#: ../../library/json.rst:158
msgid ""
"If *check_circular* is false (default: ``True``), then the circular "
"reference check for container types will be skipped and a circular reference"
" will result in a :exc:`RecursionError` (or worse)."
msgstr ""
"如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環參照 (circular "
"reference) 的檢查將會被跳過,若有循環參照則最後將引發 :exc:`RecursionError` (或其他更糟的錯誤)。"
#: ../../library/json.rst:162
msgid ""
"If *allow_nan* is false (default: ``True``), then it will be a "
":exc:`ValueError` to serialize out of range :class:`float` values (``nan``, "
"``inf``, ``-inf``) in strict compliance of the JSON specification. If "
"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, "
"``-Infinity``) will be used."
msgstr ""
"如果 *allow_nan* 為 false(預設值:``True``\\ ),則串列化超出嚴格 JSON 規範之範圍的 :class:`float` "
"值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:`ValueError`。如果 *allow_nan* 為 "
"true,則將使用它們的 JavaScript 等效項 (``NaN``, ``Infinity``, ``-Infinity``)。"
#: ../../library/json.rst:168 ../../library/json.rst:452
msgid ""
"If *indent* is a non-negative integer or string, then JSON array elements "
"and object members will be pretty-printed with that indent level. An indent"
" level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the"
" default) selects the most compact representation. Using a positive integer "
"indent indents that many spaces per level. If *indent* is a string (such as"
" ``\"\\t\"``), that string is used to indent each level."
msgstr ""
"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進行漂亮列印。縮排等級 0、負數或 ``\"\"`` "
"只會插入換行符號。``None``\\ (預設值)選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如果 *indent* "
"是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。"
#: ../../library/json.rst:175 ../../library/json.rst:459
msgid "Allow strings for *indent* in addition to integers."
msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。"
#: ../../library/json.rst:178 ../../library/json.rst:462
msgid ""
"If specified, *separators* should be an ``(item_separator, key_separator)`` "
"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', "
"': ')`` otherwise. To get the most compact JSON representation, you should "
"specify ``(',', ':')`` to eliminate whitespace."
msgstr ""
"如果有指定本參數,*separators* 應該是一個 ``(item_separator, key_separator)`` 元組。如果 "
"*indent* 為 ``None`` 則預設為 ``(', ', ': ')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 "
"JSON 表示形式,你應該指定 ``(',', ':')`` 來消除空格。"
#: ../../library/json.rst:183 ../../library/json.rst:467
msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``."
msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 當預設值"
#: ../../library/json.rst:186 ../../library/json.rst:470
msgid ""
"If specified, *default* should be a function that gets called for objects "
"that can't otherwise be serialized. It should return a JSON encodable "
"version of the object or raise a :exc:`TypeError`. If not specified, "
":exc:`TypeError` is raised."
msgstr ""
"如果有指定本參數,*default* 應該是一個為無法串列化的物件呼叫的函式。它應該傳回物件的 JSON 可編碼版本或引發 "
":exc:`TypeError`。如果未指定,則會引發 :exc:`TypeError`。"
#: ../../library/json.rst:191
msgid ""
"If *sort_keys* is true (default: ``False``), then the output of dictionaries"
" will be sorted by key."
msgstr "如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵排序。"
#: ../../library/json.rst:194
msgid ""
"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the "
":meth:`~JSONEncoder.default` method to serialize additional types), specify "
"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used."
msgstr ""
"若要使用自訂 :class:`JSONEncoder` 子類別(例如覆寫 :meth:`~JSONEncoder.default` "
"方法來串列化其他型別的子類別),請使用關鍵字參數 *cls* 指定它;否則使用 :class:`JSONEncoder`。"
#: ../../library/json.rst:198 ../../library/json.rst:277
msgid ""
"All optional parameters are now :ref:`keyword-only <keyword-"
"only_parameter>`."
msgstr "所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 參數了。"
#: ../../library/json.rst:203
msgid ""
"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so "
"trying to serialize multiple objects with repeated calls to :func:`dump` "
"using the same *fp* will result in an invalid JSON file."
msgstr ""
"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 沒有二進位分框的協定,因此嘗試重複呼叫 :func:`dump` "
"來串列化多個物件到同一個 *fp* 裡將導致無效的 JSON 檔案。"
# SkyLull: 我想這裡的 "framed protocol" 指的是
# https://peps.python.org/pep-3154/#framing
#: ../../library/json.rst:212
msgid ""
"Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion"
" table <py-to-json-table>`. The arguments have the same meaning as in "
":func:`dump`."
msgstr ""
"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 串列化為 JSON 格式 "
":class:`str`。這個參數的作用與 :func:`dump` 中的同名參數意義相同。"
#: ../../library/json.rst:218
msgid ""
"Keys in key/value pairs of JSON are always of the type :class:`str`. When a "
"dictionary is converted into JSON, all the keys of the dictionary are "
"coerced to strings. As a result of this, if a dictionary is converted into "
"JSON and then back into a dictionary, the dictionary may not equal the "
"original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys."
msgstr ""
"JSON 鍵/值對中的鍵始終為 :class:`str` 型別。當字典被轉換為 JSON "
"時,字典的所有鍵值資料型別都會被強制轉換為字串。因此,如果將字典先轉換為 JSON 格式然後再轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典"
" x 含有非字串鍵值,則 ``loads(dumps(x)) != x``。"
#: ../../library/json.rst:227
msgid ""
"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or "
":term:`binary file` containing a JSON document) to a Python object using "
"this :ref:`conversion table <json-to-py-table>`."
msgstr ""
"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *fp*\\ (一個支援 ``.read()``、包含 JSON "
"文件的\\ :term:`文字檔案 <text file>`\\ 或\\ :term:`二進位檔案 <binary file>`\\ )去串列化為 "
"Python 物件。"
#: ../../library/json.rst:231
msgid ""
"*object_hook* is an optional function that will be called with the result of"
" any object literal decoded (a :class:`dict`). The return value of "
"*object_hook* will be used instead of the :class:`dict`. This feature can "
"be used to implement custom decoders (e.g. `JSON-RPC "
"<https://www.jsonrpc.org>`_ class hinting)."
msgstr ""
"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:`dict`\\ )將被傳入這個函數、並使用"
" *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC "
"<https://www.jsonrpc.org>`_ 類別提示)。"
#: ../../library/json.rst:237
msgid ""
"*object_pairs_hook* is an optional function that will be called with the "
"result of any object literal decoded with an ordered list of pairs. The "
"return value of *object_pairs_hook* will be used instead of the "
":class:`dict`. This feature can be used to implement custom decoders. If "
"*object_hook* is also defined, the *object_pairs_hook* takes priority."
msgstr ""
"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of "
"pairs)解碼結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` "
"輸出。此功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。"
#: ../../library/json.rst:243 ../../library/json.rst:348
msgid "Added support for *object_pairs_hook*."
msgstr "新增對於 *object_pairs_hook* 的支援。"
#: ../../library/json.rst:246 ../../library/json.rst:351
msgid ""
"*parse_float*, if specified, will be called with the string of every JSON "
"float to be decoded. By default, this is equivalent to ``float(num_str)``. "
"This can be used to use another datatype or parser for JSON floats (e.g. "
":class:`decimal.Decimal`)."
msgstr ""
"如有給定 *parse_float* 的話,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定的函數來進行解碼。預設情況的浮點數剖析器等效於 "
"``float(num_str)``。這個參數可用於將 JSON 中的浮點數解碼或剖析為另一種資料型別(例如 "
":class:`decimal.Decimal`\\ )。"
#: ../../library/json.rst:251 ../../library/json.rst:356
msgid ""
"*parse_int*, if specified, will be called with the string of every JSON int "
"to be decoded. By default, this is equivalent to ``int(num_str)``. This "
"can be used to use another datatype or parser for JSON integers (e.g. "
":class:`float`)."
msgstr ""
"如有給定 *parse_int* 的話,每個要被解碼的 JSON 整數字串都會改用這個參數給定的函數來進行解碼。預設情況的整數剖析器等效於 "
"``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別(例如 :class:`float`\\ )。"
#: ../../library/json.rst:256
msgid ""
"The default *parse_int* of :func:`int` now limits the maximum length of the "
"integer string via the interpreter's :ref:`integer string conversion length "
"limitation <int_max_str_digits>` to help avoid denial of service attacks."
msgstr ""
":func:`int` 預設的 *parse_int* 現在有限制整數字串的長度上限了,限制由直譯器的\\ :ref:`整數字串轉換長度限制 "
"<int_max_str_digits>`\\ 機制來達成,這能防止阻斷服務攻擊 (denial of service attacks)。"
#: ../../library/json.rst:262 ../../library/json.rst:361
msgid ""
"*parse_constant*, if specified, will be called with one of the following "
"strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to "
"raise an exception if invalid JSON numbers are encountered."
msgstr ""
"如有給定 *parse_constant* 的話,在解碼時若遭遇以下字串 ``'-Infinity'``、``'Infinity'`` 或 "
"``'NaN'`` 其中之一則會改用這個參數給定的函數來進行解碼。這也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。"
#: ../../library/json.rst:267
msgid ""
"*parse_constant* doesn't get called on 'null', 'true', 'false' anymore."
msgstr "遭遇 'null'、 'true'、 'false' 時不再以 *parse_constant* 給定的函數來處理了。"
#: ../../library/json.rst:270
msgid ""
"To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` "
"kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments"
" will be passed to the constructor of the class."
msgstr ""
"若想要使用自定義的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字參數指定之,否則將使用預設的 "
":class:`JSONDecoder`。其他未使用到的關鍵字參數將繼續傳入給 :class:`JSONDecoder` 的建構函數使用。"
#: ../../library/json.rst:274 ../../library/json.rst:292
#: ../../library/json.rst:371
msgid ""
"If the data being deserialized is not a valid JSON document, a "
":exc:`JSONDecodeError` will be raised."
msgstr "如果被去串列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:`JSONDecodeError` 例外。"
#: ../../library/json.rst:280
msgid ""
"*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, "
"UTF-16 or UTF-32."
msgstr ""
"現在,*fp* 可以是一個\\ :term:`二進位檔案 <binary file>`\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 "
"UTF-32。"
#: ../../library/json.rst:286
msgid ""
"Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` "
"instance containing a JSON document) to a Python object using this "
":ref:`conversion table <json-to-py-table>`."
msgstr ""
"使用\\ :ref:`轉換表 <json-to-py-table>`\\ 將 *s* (一個含有 JSON 文件的 :class:`str`\\ 、\\"
" :class:`bytes` 或 :class:`bytearray` 的實例(instance))去串列化(deserialize)為一個 "
"Python 物件"
#: ../../library/json.rst:290
msgid "The other arguments have the same meaning as in :func:`load`."
msgstr "其餘參數的使用方式與意義和 :func:`load` 的相同。"
#: ../../library/json.rst:295
msgid ""
"*s* can now be of type :class:`bytes` or :class:`bytearray`. The input "
"encoding should be UTF-8, UTF-16 or UTF-32."
msgstr ""
"現在,*s* 可以是一個\\ :term:`二進位檔案 <binary file>`\\ ,前提是其編碼格式為 UTF-8、UTF-16 或 "
"UTF-32。"
#: ../../library/json.rst:299
msgid "The keyword argument *encoding* has been removed."
msgstr "刪除關鍵字參數 *encoding*。"
#: ../../library/json.rst:304
msgid "Encoders and Decoders"
msgstr "編碼器與解碼器"
#: ../../library/json.rst:308
msgid "Simple JSON decoder."
msgstr "簡易 JSON 解碼器"
#: ../../library/json.rst:310
msgid "Performs the following translations in decoding by default:"
msgstr "預設將執行下列資料型別轉換:"
#: ../../library/json.rst:315 ../../library/json.rst:404
msgid "JSON"
msgstr "JSON"
#: ../../library/json.rst:315 ../../library/json.rst:404
msgid "Python"
msgstr "Python"
#: ../../library/json.rst:317 ../../library/json.rst:406
msgid "object"
msgstr "object"
#: ../../library/json.rst:317 ../../library/json.rst:406
msgid "dict"
msgstr "dict"
#: ../../library/json.rst:319 ../../library/json.rst:408
msgid "array"
msgstr "array"
#: ../../library/json.rst:319
msgid "list"
msgstr "list"
#: ../../library/json.rst:321 ../../library/json.rst:410
msgid "string"
msgstr "string"
#: ../../library/json.rst:321 ../../library/json.rst:410
msgid "str"
msgstr "str"
#: ../../library/json.rst:323
msgid "number (int)"
msgstr "number (int)"
#: ../../library/json.rst:323
msgid "int"
msgstr "int"
#: ../../library/json.rst:325
msgid "number (real)"
msgstr ""
#: ../../library/json.rst:325
msgid "float"
msgstr "float"
#: ../../library/json.rst:327 ../../library/json.rst:414
msgid "true"
msgstr "true"
#: ../../library/json.rst:327 ../../library/json.rst:414
msgid "True"
msgstr "True"
#: ../../library/json.rst:329 ../../library/json.rst:416
msgid "false"
msgstr "false"
#: ../../library/json.rst:329 ../../library/json.rst:416
msgid "False"
msgstr "False"
#: ../../library/json.rst:331 ../../library/json.rst:418
msgid "null"
msgstr "null"
#: ../../library/json.rst:331 ../../library/json.rst:418
msgid "None"
msgstr "None"
#: ../../library/json.rst:334
msgid ""
"It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their "
"corresponding ``float`` values, which is outside the JSON spec."
msgstr ""
"雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,解碼器依然能正確的將其對應到相應的 "
"Python ``float`` 值。"
#: ../../library/json.rst:337
msgid ""
"*object_hook*, if specified, will be called with the result of every JSON "
"object decoded and its return value will be used in place of the given "
":class:`dict`. This can be used to provide custom deserializations (e.g. to"
" support `JSON-RPC <https://www.jsonrpc.org>`_ class hinting)."
msgstr ""
"*object_hook* 是一個可選參數,其接受一個函數作為輸入。原始的字串解碼結果(一個 :class:`dict`\\ )將被傳入這個函數、並使用"
" *object_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作自訂義解碼器(例如 `JSON-RPC "
"<https://www.jsonrpc.org>`_ 類別提示)。"
#: ../../library/json.rst:342
msgid ""
"*object_pairs_hook*, if specified will be called with the result of every "
"JSON object decoded with an ordered list of pairs. The return value of "
"*object_pairs_hook* will be used instead of the :class:`dict`. This feature"
" can be used to implement custom decoders. If *object_hook* is also "
"defined, the *object_pairs_hook* takes priority."
msgstr ""
"*object_pairs_hook* 是一個可選參數,其接受一個函數作為輸入。原始的有序對列表(ordered list of "
"pairs)解碼結果將被傳入這個函數、並使用 *object_pairs_hook* 的回傳值來取代原先的 :class:`dict` "
"輸出。此功能可用於實作自訂義解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。"
#: ../../library/json.rst:366
msgid ""
"If *strict* is false (``True`` is the default), then control characters will"
" be allowed inside strings. Control characters in this context are those "
"with character codes in the 0--31 range, including ``'\\t'`` (tab), "
"``'\\n'``, ``'\\r'`` and ``'\\0'``."
msgstr ""
"如果 *strict* 被設為 false(預設值為 ``True``),那麼字串中將允許控制字元。此語境中的控制字元指的是 ASCII 字元編碼在 "
"0~31 範圍內的字元,包括 ``'\\t'``(tab 鍵)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。"
#: ../../library/json.rst:374 ../../library/json.rst:475
msgid "All parameters are now :ref:`keyword-only <keyword-only_parameter>`."
msgstr "所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 參數了。"
#: ../../library/json.rst:379
msgid ""
"Return the Python representation of *s* (a :class:`str` instance containing "
"a JSON document)."
msgstr "返回用 Python 方式表達的 *s*(一個含有 JSON 文件的 :class:`str` 實例(instance))"
#: ../../library/json.rst:382
msgid ""
":exc:`JSONDecodeError` will be raised if the given JSON document is not "
"valid."
msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。"
#: ../../library/json.rst:387
msgid ""
"Decode a JSON document from *s* (a :class:`str` beginning with a JSON "
"document) and return a 2-tuple of the Python representation and the index in"
" *s* where the document ended."
msgstr ""
"將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON "
"文件結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。"
#: ../../library/json.rst:391
msgid ""
"This can be used to decode a JSON document from a string that may have "
"extraneous data at the end."
msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。"
#: ../../library/json.rst:397
msgid "Extensible JSON encoder for Python data structures."
msgstr "可擴充的 Python 資料結構 JSON 編碼器。"
#: ../../library/json.rst:399
msgid "Supports the following objects and types by default:"
msgstr "預設可支援下列物件及型別:"
#: ../../library/json.rst:408
msgid "list, tuple"
msgstr "list, tuple"
#: ../../library/json.rst:412
msgid "int, float, int- & float-derived Enums"
msgstr "int, float, int 和 float 格式的 Enums"
#: ../../library/json.rst:412
msgid "number"
msgstr "number"
#: ../../library/json.rst:421
msgid "Added support for int- and float-derived Enum classes."
msgstr "增加整數(int)和浮點數(float)格式的列舉序數(Enums)的支援性。"
#: ../../library/json.rst:424
msgid ""
"To extend this to recognize other objects, subclass and implement a "
":meth:`~JSONEncoder.default` method with another method that returns a "
"serializable object for ``o`` if possible, otherwise it should call the "
"superclass implementation (to raise :exc:`TypeError`)."
msgstr ""
"若要擴充此功能來識別其他物件,請繼承並實作一個 :meth:`~JSONEncoder.default` 方法。此方法應回傳一個可序列化的 ``o`` "
"物件,否則此方法應呼叫父類別的 :meth:`~JSONEncoder.default` 方法(以拋出 :exc:`TypeError` 例外)。"
#: ../../library/json.rst:429
msgid ""
"If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when"
" trying to encode keys that are not :class:`str`, :class:`int`, "
":class:`float` or ``None``. If *skipkeys* is true, such items are simply "
"skipped."
msgstr ""
"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`,:class:`int`,:class:`float` 或"
" ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。"
#: ../../library/json.rst:437
msgid ""
"If *check_circular* is true (the default), then lists, dicts, and custom "
"encoded objects will be checked for circular references during encoding to "
"prevent an infinite recursion (which would cause a :exc:`RecursionError`). "
"Otherwise, no such check takes place."
msgstr ""
"如果 *check_circular* 為 "
"true(預設值),則會在編碼期間檢查列表(list)、字典(dict)和自定義編碼物件的循環參照,以防止無限遞迴(一個會導致 "
":exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。"
#: ../../library/json.rst:442
msgid ""
"If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and "
"``-Infinity`` will be encoded as such. This behavior is not JSON "
"specification compliant, but is consistent with most JavaScript based "
"encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode "
"such floats."
msgstr ""
"如果 *allow_nan* 為 true(預設值),則 ``NaN``、``Infinity`` 和 ``-Infinity`` "
"將按照原樣進行編碼。請記得此行為不符合標準 JSON 規範,但的確與大多數基於 JavaScript 的編碼器和解碼器一致。否則若設為 "
"false,嘗試對這些浮點數進行編碼將引發 :exc:`ValueError` 例外。"
#: ../../library/json.rst:448
msgid ""
"If *sort_keys* is true (default: ``False``), then the output of dictionaries"
" will be sorted by key; this is useful for regression tests to ensure that "
"JSON serializations can be compared on a day-to-day basis."
msgstr ""
"如果 *sort_keys* 為 true(預設值:``False``),則 dictionary(字典)的輸出將按鍵值排序。這項功能可確保 JSON "
"序列化的結果能被互相比較,能讓日常的回歸測試檢查變得方便一些。"
#: ../../library/json.rst:481
msgid ""
"Implement this method in a subclass such that it returns a serializable "
"object for *o*, or calls the base implementation (to raise a "
":exc:`TypeError`)."
msgstr "在任意一個子類別裡實作這個方法時須讓其回傳一個可串列化的物件 *o* ,或呼叫原始的實作以引發 :exc:`TypeError` 例外。"
#: ../../library/json.rst:485
msgid ""
"For example, to support arbitrary iterators, you could implement "
":meth:`~JSONEncoder.default` like this::"
msgstr "舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:`~JSONEncoder.default`::"
#: ../../library/json.rst:501
msgid ""
"Return a JSON string representation of a Python data structure, *o*. For "
"example::"
msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如::"
# 執行下列程式後能證明他的回傳物件是generator
# >>> import json
# >>> bigobject = list(range(100000))
# >>> x = json.JSONEncoder().iterencode(bigobject)
# >>> print(x)
# <generator object _make_iterencode.<locals>._iterencode at 0x7293c4b48bc0>
#: ../../library/json.rst:510
msgid ""
"Encode the given object, *o*, and yield each string representation as "
"available. For example::"
msgstr "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的生成器物件(generator)。如下例::"
#: ../../library/json.rst:518
msgid "Exceptions"
msgstr "例外"
#: ../../library/json.rst:522
msgid ""
"Subclass of :exc:`ValueError` with the following additional attributes:"
msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:"
#: ../../library/json.rst:526
msgid "The unformatted error message."
msgstr "未受格式化的錯誤訊息。"
#: ../../library/json.rst:530
msgid "The JSON document being parsed."
msgstr "正在被剖析的 JSON 文件。"
#: ../../library/json.rst:534
msgid "The start index of *doc* where parsing failed."
msgstr "*doc* 剖析失敗處的起始點的索引值。"
#: ../../library/json.rst:538
msgid "The line corresponding to *pos*."
msgstr "*pos* 所在的行數。"
#: ../../library/json.rst:542
msgid "The column corresponding to *pos*."
msgstr "*pos* 所在的列(column)數。"
#: ../../library/json.rst:548
msgid "Standard Compliance and Interoperability"
msgstr "合規性與互通性"
#: ../../library/json.rst:550
msgid ""
"The JSON format is specified by :rfc:`7159` and by `ECMA-404 "
"<https://www.ecma-international.org/publications-and-"
"standards/standards/ecma-404/>`_. This section details this module's level "
"of compliance with the RFC. For simplicity, :class:`JSONEncoder` and "
":class:`JSONDecoder` subclasses, and parameters other than those explicitly "
"mentioned, are not considered."
msgstr ""
"JSON 格式是由 :rfc:`7159` 和 `ECMA-404 <https://www.ecma-"
"international.org/publications-and-standards/standards/ecma-404/>` "
"規範的。本節詳細說明了本模組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` "
"子類別以及未明確提及的參數將不予考慮。"
#: ../../library/json.rst:556
msgid ""
"This module does not comply with the RFC in a strict fashion, implementing "
"some extensions that are valid JavaScript but not valid JSON. In "
"particular:"
msgstr ""
"這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 JavaScript 語法格式,但並不符合 JSON 格式:"
#: ../../library/json.rst:559
msgid "Infinite and NaN number values are accepted and output;"
msgstr "無限(Infinite)和非數字(NaN)值會被接受。"
#: ../../library/json.rst:560
msgid ""
"Repeated names within an object are accepted, and only the value of the last"
" name-value pair is used."
msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。"
#: ../../library/json.rst:563
msgid ""
"Since the RFC permits RFC-compliant parsers to accept input texts that are "
"not RFC-compliant, this module's deserializer is technically RFC-compliant "
"under default settings."
msgstr ""
"不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設定運作,本模組的去串列化器(deserializer)是符合 "
"RFC 規範的。"
#: ../../library/json.rst:568
msgid "Character Encodings"
msgstr "字元編碼格式"
#: ../../library/json.rst:570
msgid ""
"The RFC requires that JSON be represented using either UTF-8, UTF-16, or "
"UTF-32, with UTF-8 being the recommended default for maximum "
"interoperability."
msgstr "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以達成最佳的互通性。"
#: ../../library/json.rst:573
msgid ""
"As permitted, though not required, by the RFC, this module's serializer sets"
" *ensure_ascii=True* by default, thus escaping the output so that the "
"resulting strings only contain ASCII characters."
msgstr ""
"RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作了此一選項作為預設,因此本模組預設會轉義所有非 "
"ASCII 字元。"
#: ../../library/json.rst:577
msgid ""
"Other than the *ensure_ascii* parameter, this module is defined strictly in "
"terms of conversion between Python objects and :class:`Unicode strings "
"<str>`, and thus does not otherwise directly address the issue of character "
"encodings."
msgstr ""
"除了 *ensure_ascii* 選項之外,本模組嚴格遵循 Python 物件與 :class:`Unicode strings <str>` "
"之間的轉換規範,因此並不另外處理字元編碼的問題。"
#: ../../library/json.rst:582
msgid ""
"The RFC prohibits adding a byte order mark (BOM) to the start of a JSON "
"text, and this module's serializer does not add a BOM to its output. The RFC"
" permits, but does not require, JSON deserializers to ignore an initial BOM "
"in their input. This module's deserializer raises a :exc:`ValueError` when "
"an initial BOM is present."
msgstr ""
"RFC 禁止在文件的開頭加上端序記號(BOM),因此本模組的串列化器(serializer)也不會在輸出中加入端序記號。RFC 允許但不強制 JSON "
"去串列化器(deserializer)忽略文件初始的端序記號,因此本模組的去串列化器將在遭遇位於文件開頭的端序記號時引發 "
":exc:`ValueError` 例外。"
#: ../../library/json.rst:588
msgid ""
"The RFC does not explicitly forbid JSON strings which contain byte sequences"
" that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 "
"surrogates), but it does note that they may cause interoperability problems."
" By default, this module accepts and outputs (when present in the original "
":class:`str`) code points for such sequences."
msgstr ""
"RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配對的 UTF-16 代理對(surrogate "
"pairs)),但這個特性的確可能會引起相容性問題。預設情況下,當原始輸入的 :class:`str` "
"中存在此類序列時,該模組將接受並輸出這些序列的編碼位置(code points)。"
#: ../../library/json.rst:596
msgid "Infinite and NaN Number Values"
msgstr ""
#: ../../library/json.rst:598
msgid ""
"The RFC does not permit the representation of infinite or NaN number values."
" Despite that, by default, this module accepts and outputs ``Infinity``, "
"``-Infinity``, and ``NaN`` as if they were valid JSON number literal "
"values::"
msgstr ""
#: ../../library/json.rst:613
msgid ""
"In the serializer, the *allow_nan* parameter can be used to alter this "
"behavior. In the deserializer, the *parse_constant* parameter can be used "
"to alter this behavior."
msgstr ""
#: ../../library/json.rst:619
msgid "Repeated Names Within an Object"
msgstr ""
#: ../../library/json.rst:621
msgid ""
"The RFC specifies that the names within a JSON object should be unique, but "
"does not mandate how repeated names in JSON objects should be handled. By "
"default, this module does not raise an exception; instead, it ignores all "
"but the last name-value pair for a given name::"
msgstr ""
#: ../../library/json.rst:630
msgid "The *object_pairs_hook* parameter can be used to alter this behavior."
msgstr "*object_parts_hook* 參數可以被使用來改變此行為。"
#: ../../library/json.rst:634
msgid "Top-level Non-Object, Non-Array Values"
msgstr ""
#: ../../library/json.rst:636
msgid ""
"The old version of JSON specified by the obsolete :rfc:`4627` required that "
"the top-level value of a JSON text must be either a JSON object or array "
"(Python :class:`dict` or :class:`list`), and could not be a JSON null, "
"boolean, number, or string value. :rfc:`7159` removed that restriction, and"
" this module does not and has never implemented that restriction in either "
"its serializer or its deserializer."
msgstr ""
#: ../../library/json.rst:643
msgid ""
"Regardless, for maximum interoperability, you may wish to voluntarily adhere"
" to the restriction yourself."
msgstr ""
#: ../../library/json.rst:648
msgid "Implementation Limitations"
msgstr ""
#: ../../library/json.rst:650
msgid "Some JSON deserializer implementations may set limits on:"
msgstr ""
#: ../../library/json.rst:652
msgid "the size of accepted JSON texts"
msgstr ""
#: ../../library/json.rst:653
msgid "the maximum level of nesting of JSON objects and arrays"
msgstr ""
#: ../../library/json.rst:654
msgid "the range and precision of JSON numbers"
msgstr ""
#: ../../library/json.rst:655
msgid "the content and maximum length of JSON strings"
msgstr ""
#: ../../library/json.rst:657
msgid ""
"This module does not impose any such limits beyond those of the relevant "
"Python datatypes themselves or the Python interpreter itself."
msgstr ""
#: ../../library/json.rst:660
msgid ""
"When serializing to JSON, beware any such limitations in applications that "
"may consume your JSON. In particular, it is common for JSON numbers to be "
"deserialized into IEEE 754 double precision numbers and thus subject to that"
" representation's range and precision limitations. This is especially "
"relevant when serializing Python :class:`int` values of extremely large "
"magnitude, or when serializing instances of \"exotic\" numerical types such "
"as :class:`decimal.Decimal`."
msgstr ""
#: ../../library/json.rst:673
msgid "Command Line Interface"
msgstr "命令列介面"
#: ../../library/json.rst:678
msgid "**Source code:** :source:`Lib/json/tool.py`"
msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`"
#: ../../library/json.rst:682
msgid ""
"The :mod:`json.tool` module provides a simple command line interface to "
"validate and pretty-print JSON objects."
msgstr ""
#: ../../library/json.rst:685
msgid ""
"If the optional ``infile`` and ``outfile`` arguments are not specified, "
":data:`sys.stdin` and :data:`sys.stdout` will be used respectively:"
msgstr ""
#: ../../library/json.rst:697
msgid ""
"The output is now in the same order as the input. Use the :option:`--sort-"
"keys` option to sort the output of dictionaries alphabetically by key."
msgstr ""
#: ../../library/json.rst:704
msgid "Command line options"
msgstr "命令列選項"
#: ../../library/json.rst:708
msgid "The JSON file to be validated or pretty-printed:"
msgstr ""
#: ../../library/json.rst:724
msgid "If *infile* is not specified, read from :data:`sys.stdin`."
msgstr ""
#: ../../library/json.rst:728
msgid ""
"Write the output of the *infile* to the given *outfile*. Otherwise, write it"
" to :data:`sys.stdout`."
msgstr ""
#: ../../library/json.rst:733
msgid "Sort the output of dictionaries alphabetically by key."
msgstr ""
#: ../../library/json.rst:739
msgid ""
"Disable escaping of non-ascii characters, see :func:`json.dumps` for more "
"information."
msgstr ""
#: ../../library/json.rst:745
msgid "Parse every input line as separate JSON object."
msgstr ""
#: ../../library/json.rst:751
msgid "Mutually exclusive options for whitespace control."
msgstr ""
#: ../../library/json.rst:757
msgid "Show the help message."
msgstr ""
#: ../../library/json.rst:761
msgid "Footnotes"
msgstr "註解"
#: ../../library/json.rst:762
msgid ""
"As noted in `the errata for RFC 7159 <https://www.rfc-"
"editor.org/errata_search.php?rfc=7159>`_, JSON permits literal U+2028 (LINE "
"SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) characters in strings, whereas "
"JavaScript (as of ECMAScript Edition 5.1) does not."
msgstr ""