![](/img/trans.png)
[英]Trying to decode an event using rescript-json-combinators
嘗試使用 rescript-json-combinators 為 decodeEvent 創建等效項。 我不知道如何替換“Decoder(decoder)”,因為解碼器在 rescript-json-combinators 中被抽象化了。 嘗試使用 Decode.decode 沒有用。 關於如何解決 ...
[英]Trying to decode an event using rescript-json-combinators
嘗試使用 rescript-json-combinators 為 decodeEvent 創建等效項。 我不知道如何替換“Decoder(decoder)”,因為解碼器在 rescript-json-combinators 中被抽象化了。 嘗試使用 Decode.decode 沒有用。 關於如何解決 ...
[英]Is there a way to encode integer values that are larger than 32 bits using bs-json?
我一直在使用字符串來表示大於 32 位的解碼 JSON 整數。 似乎string_of_int能夠處理大型 integer 輸入。 因此,編寫了一個解碼器(在 Json.Decode 命名空間中): 成功處理至少 37 位的整數。 另一方面,編碼對我來說很麻煩。 遠程服務器不接受字符串表示,並且需 ...
[英]How to read JSON with unknown key in ReasonML?
我正在編寫一個簡單的應用程序,它顯示來自Dog API的狗圖像。 我用 bs-json 把它做成記錄,以后再用。 品種列表可通過 API 獲取。 響應看起來像這樣。{ "message": { "breed": ["array of sub-breeds"], "breed withou ...
[英]How to convert Js.Json.t to Js.t('a)?
我已經通過 bs-json 編碼了一個對象,並希望使用 bs-axios 通過 post 將其作為數據發送。 33 │ let createTest = (p: Data.toBuyListItem) => inst->Instance.postData("/ test ...
[英]How to decode GeoJson in ReasonML?
請評論如何在 ReasonML 中解碼 GeoJson 文件? 我嘗試在解碼器中沒有“字段緯度和經度”的情況下解碼坐標,但我找不到任何關於如何解析 JSON 文件中的字段坐標的信息。 GeoJson 文件 ReasonML 中的 JsonDecoder (bs-json) ...
[英]What does Json.Decode.{} mean? The dot curly braces part
我正在嘗試學習ReasonML並遵循bs-json的示例,我們可以將原始json解碼為如下類型: type point = { x: float, y: float }; module Decode = { let point = json => Json.Deco ...
[英]Using bs-json to Decode object with dynamic keys in root
我試圖將以下JSON對象解碼為Reason對象。 {"AAPL":{"price":217.36}} 對象根目錄中的鍵是動態的。 當密鑰不在根目錄中時,以下一般示例有效。 我如何更改它以便它適用於根中的動態密鑰? ...
[英]Convert JSON field to ReasonML variant
我有一個JSON結構,包含一個可以是對象或字符串的字段period 。 我已經在我的代碼中准備了變量,並且它工作正常: 問題是當我嘗試將輸入JSON轉換為變體類型時:我根本就不知道該怎么做。 這是我的嘗試: 現在,當然這不起作用,因為我試圖匹配仍然是Js.Json.t類型的J ...