Skip to content

XML and JSON function work#14884

Draft
jdunkerley wants to merge 10 commits intodevelopfrom
wip/jd/xml-json-work
Draft

XML and JSON function work#14884
jdunkerley wants to merge 10 commits intodevelopfrom
wip/jd/xml-json-work

Conversation

@jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented Mar 17, 2026

Pull Request Description

  • Extensions for Hashset: to_text, to_display_text, pretty and Table visualization now work.
  • Aligned Dictionary: to_display_text so shows first 40 (same as Vector).
  • Conversion to and from Vector for Hashset and Dictionary.
  • Refactored JsonOperation:
    • Remove the TableVizOperation code to its own class.
    • Made it an instance class allowing for use for JSON stringify in the Table.
  • Add json_stringify to Table, Column and Any.
    • Any
    • Table
    • Column
  • Add parse_json to Table and Column.
  • Add conversion for XML_Document to XML_Element.
  • Add get_xpath_text method to XML_Element and XML_Document - reading the text value of the first matching node or attribute.
  • Add new design for to_js_object on XML_Element and XML_Document.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@jdunkerley jdunkerley changed the title Wip/jd/xml json work XML and JSON function work Mar 17, 2026
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashset existence is surprising to me...

"Hashset.from_vector " + self.to_vector.pretty

## Convert from a Vector to a Hashset
Hashset.from (that:Vector) (error_on_duplicates:Boolean=False) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The name Hashset is strange knowing we have Dictionary and not Hashmap
  • Shouldn't it be just a Set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was named a long time ago to avoid some naming clashes at the time - Set and Map had too many meanings within the Enso context. Map was hence chosen to be Dictionary, and Set was called Hashset (allowing the technical details to leak as its a more internal class).

icon: convert
---
Converts the given value to a JSON serialized value.
Any.json_stringify self -> Text = self.to_json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to_json and json_stringify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility with Table. Table needs a row-based JSON conversion function, and to_json is the standard API we use for serialising objects to JSON. Table is serialised by the to_json and uses json_stringify for the row-based operation.

Having the same method on Any is for compatibility.

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

Successfully merging this pull request may close these issues.

2 participants