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

fn:parse-json, fn:json-to-xml: number-parser, fallback #973

Closed
ChristianGruen opened this issue Jan 29, 2024 · 0 comments
Closed

fn:parse-json, fn:json-to-xml: number-parser, fallback #973

ChristianGruen opened this issue Jan 29, 2024 · 0 comments
Labels
Enhancement A change or improvement to an existing feature Tests Needed Tests need to be written or merged XQFO An issue related to Functions and Operators

Comments

@ChristianGruen
Copy link
Contributor

ChristianGruen commented Jan 29, 2024

  1. See JSON Parsing & Serialization: Numbers #33: number-parser option needs to be added to fn:json-to-xml.
  2. Similar to fn:replace, I would suggest using function(xs:untypedAtomic) as item()?) as signature for both the fallback and the number-parser option, and (for fallback) to invoke fn:string#1 on the result. This way, explicit casts in the code get obsolete. Queries like the following one…
parse-json(
  '-123',
  map { 'number-parser': fn($n) { $n => number() => abs() }
)

…can then be simplified to parse-json('-123', abs#1).

@ChristianGruen ChristianGruen added XQFO An issue related to Functions and Operators Enhancement A change or improvement to an existing feature labels Jan 29, 2024
@ChristianGruen ChristianGruen added the Tests Needed Tests need to be written or merged label Jan 29, 2024
@ndw ndw closed this as completed in be64138 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A change or improvement to an existing feature Tests Needed Tests need to be written or merged XQFO An issue related to Functions and Operators
Projects
None yet
Development

No branches or pull requests

1 participant