1// Copyright 2020 Google Inc. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15//////////////////////////////////////////////////////////////////////////////// 16 17// The proto definition for JSON format has been written based on 18// http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf 19 20syntax = "proto2"; 21 22package json_proto; 23 24message JsonParseAPI { 25 required int32 settings = 1; 26 required JsonObject object_value = 2; 27} 28 29message JsonObject { 30 required int32 settings = 1; 31 required string name = 2; 32 required JsonValue value = 3; 33} 34 35message JsonValue { 36 oneof value { 37 // Json value types: 38 39 // null: null, will be used when 'oneof' contains nothing 40 41 // object: another json object of any type 42 JsonObject object_value = 1; 43 44 // array: an array of values 45 ArrayValue array_value = 2; 46 47 // number: can be an integer, a float, an exponent 48 NumberValue number_value = 3; 49 50 // string: unicode string 51 StringValue string_value = 4; 52 53 // boolean: true or talse 54 BooleanValue boolean_value = 5; 55 } 56} 57 58message ArrayValue { 59 repeated JsonValue value = 1; 60} 61 62message NumberInteger { 63 required int64 value = 1; 64} 65 66message NumberFloat { 67 required double value = 1; 68} 69 70message NumberExponent { 71 required int32 base = 1; 72 required int32 exponent = 2; 73 required bool use_uppercase = 3; 74} 75 76message NumberExponentFrac { 77 required float base = 1; 78 required int32 exponent = 2; 79 required bool use_uppercase = 3; 80} 81 82message NumberValue { 83 required NumberInteger integer_value = 1; 84 85 // integer_value is used when oneof field below has nothing. 86 oneof value { 87 NumberFloat float_value = 2; 88 NumberExponent exponent_value = 3; 89 NumberExponentFrac exponent_frac_value = 4; 90 } 91} 92 93message StringValue { 94 required string value = 1; 95} 96 97message BooleanValue { 98 required bool value = 1; 99} 100