问题标签 [argonaut]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
scala - 使用 Argonaut 解码折射
我正在尝试使用 argonaut以refract样式解码 json。
斯卡斯蒂:http ://scastie.org/15196
错误:尝试解码失败光标上的值。:[*.--(meta)]
我不明白为什么它不起作用,一切meta
都是可选的,甚至Meta
它本身也是如此。
示例 JSON:
到目前为止的代码:
json - Complex Encoding of multiple nested classes using scala argonaut
What is wrong with the MainClassEncodeJson
method below?
Have been following the example for Implicit JSON conversion with Scala http://lollyrock.com/articles/scala-implicit-conversion/
This question is similar to: Encoding nested classes using scala argonaut
The difference being an additional layer/s of nesting.
Am getting the following error from the compiler:
Cannot resolve reference EncodeJson with such signature
Thanks for in advance.
Have included the Encoder and Decoder for completeness
json - 如何使用 Argonaut 解析 Map[String,String]
我想解析类似的东西:
但是当我尝试它失败时,tracking_no
因为值是null
. 我如何让它只接受null
价值?
json - 使用 argonaut/circe 解码 json 数组中的单个对象字段
假设我有这样的 json
和这样的案例类
在 play-json 中,我可以这样写:
我正在寻找一种仅解码 argonaut/circe 中“父”的“sha”的等效方法,但我没有找到任何方法。“HCursor/ACursor”有 downArray 但从那里我不知道该怎么做。非常感谢您!
shapeless - 向 argonaut-shapeles 上的 EncodeJson 实例添加附加字段
有没有办法指定添加到案例类的自动生成编码器的附加字段?该字段将是案例类所属的总和类型的类型字段,因此即使在使用子类的编码器的情况下,它也会生成有效的 json。
json - 如何使用 argonaut 镜头修改 JSON 中的值和类型?
假设以下简单的 JSON 文档:
我想更新“key”的值,但同时也改变它的类型,所以从字符串改变它到一个int。现在,使用像下面这样的 HCursor 是可能的,而且很直接:
通过“撤消”上述位置,我最终得到了一个新的 json,其中“key”具有数值而不是字符串,这是完美的。
是否可以使用镜头做同样的事情?我尝试执行以下操作:
但是,尽管我没有收到错误,但它也不起作用,最后我得到了未修改的原始 json 文档。不过,如果我尊重数据类型,事情就会按应有的方式工作。是否有理由仅将镜头用于相同数据类型的修改?或者我只是在做一些非常错误的事情:)
scala - 任何类型的对象的 JSON 和一个 TypeTag
给定一个 Any 类型的对象及其 TypeTag,如何使用 Argonaut/Shapeless 创建它的 JSON?
scala - 如何从 Argonaut Json 对象中删除具有空值的键
如何编写扩展方法以null
从 ArgonautJson
对象中删除具有值的所有键:
我试过这个:
但它似乎只是在删除对象null
顶层具有值的键Json
......
scala - 无法编译简单的 Argonaut 表达式?
这是 Scalaz 和 Argonaut 不兼容的问题还是其他问题?
构建.sbt