Skip to content
Playground(another site)

bynk.parse.duplicate_json

Error A service declares more than one json { } policy.

A service's json policy sets whether its response bodies use plain or tagged JSON, so there is one setting for the whole service. A second block would contradict the first, and is refused. Keep one. A single route can still differ with @json on its handler. The same rule holds for cors, security and limits, as bynk.parse.duplicate_cors shows.

Example

service api from http {
json { options: plain }
json { options: tagged } // ✗ a second `json`
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}
service api from http {
json { options: plain } // ✓ one setting
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}

In the Book

See also

  • The grammar rule it governs: service_decl.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.duplicate_json shows the same from the installed toolchain, without a network.