JSONEncodingOptions.swift 902 B

1234567891011121314151617181920212223242526
  1. // Sources/SwiftProtobuf/JSONEncodingOptions.swift - JSON encoding options
  2. //
  3. // Copyright (c) 2014 - 2018 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. ///
  11. /// JSON encoding options
  12. ///
  13. // -----------------------------------------------------------------------------
  14. /// Options for JSONEncoding.
  15. public struct JSONEncodingOptions {
  16. /// Always print enums as ints. By default they are printed as strings.
  17. public var alwaysPrintEnumsAsInts: Bool = false
  18. /// Whether to preserve proto field names.
  19. /// By default they are converted to JSON(lowerCamelCase) names.
  20. public var preserveProtoFieldNames: Bool = false
  21. public init() {}
  22. }