Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_jkey for undefined or missing value should return None not Some #138

Open
wallymathieu opened this issue Jan 22, 2023 · 0 comments
Open

Comments

@wallymathieu
Copy link
Member

wallymathieu commented Jan 22, 2023

Expected behavior

When you read non existing keys using _jkey should return None.

#r "nuget: Fleece.FSharpData, 0.10.0"
open Fleece
open Fleece.FSharpData
open FSharp.Data
open Fleece.FSharpData.Lens
open FSharpPlus
open FSharpPlus.Lens

JsonValue.Parse( "{ \"b\": 200}" ) ^? (_jkey "a" );;
// val it: JsonValue option = None

Actual behavior

The _jkey returns Some for undefined or missing keys.

#r "nuget: Fleece.FSharpData, 0.10.0"
open Fleece
open Fleece.FSharpData
open FSharp.Data
open Fleece.FSharpData.Lens
open FSharpPlus
open FSharpPlus.Lens

JsonValue.Parse( "{ \"b\": 200}" ) ^? (_jkey "a" );;
// val it: JsonValue option = Some null
#r "nuget: Fleece.NewtonsoftJson, 0.10.0"
open Fleece
open Fleece.Newtonsoft
open Fleece.Newtonsoft.Lens
open FSharpPlus
open FSharpPlus.Lens

JsonValue.Parse( "{ \"b\": 200}" ) ^? (_jkey "a" );;
// val it: JsonValue option = Some <seq>
@wallymathieu wallymathieu changed the title _jkey for undefined or missing value should return null not Some _jkey for undefined or missing value should return None not Some Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant