io.circe

config

package config

circe-config: A Typesafe config wrapper powered by circe.

Source
package.scala
Example:
  1. scala> import com.typesafe.config.ConfigFactory
    scala> import io.circe.generic.auto._
    scala> import io.circe.config.syntax._
    
    scala> case class ServerSettings(host: String, port: Int, ssl: Option[String])
    scala> case class HttpSettings(server: ServerSettings, version: Double)
    scala> case class AppSettings(http: HttpSettings)
    
    scala> val config = ConfigFactory.parseString("http { version = 1.1, server { host = localhost, port = 8080 } }")
    
    scala> config.as[ServerSettings]("http.server")
    res0: Either[io.circe.Error, ServerSettings] = Right(ServerSettings(localhost,8080,None))
    
    scala> config.as[HttpSettings]("http")
    res1: Either[io.circe.Error, HttpSettings] = Right(HttpSettings(ServerSettings(localhost,8080,None),1.1))
    
    scala> config.as[AppSettings]
    res2: Either[io.circe.Error, AppSettings] = Right(AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1)))
Note

Limitations for numerical types: Typesafe config uses Java's int, long and double types to represent numbers. In some cases, double values may be represented internally as long after a roundtrip since the HOCON formatting is not stable. Also, precision may be lost when converting from circe's JsonNumber to Typesafe config's number representation (as can be seen in the test for the printer laws).

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. config
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. object parser extends Parser

    Utilities for parsing com.typesafe.config.Config sources to io.circe.Json as well as decoding to a specific type.

  2. object printer

    Print io.circe.Json to a Typesafe Config string.

  3. object syntax

    Implicits for decoding Typesafe Config values and instances using circe decoders.

Inherited from AnyRef

Inherited from Any

Ungrouped