Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jeromelaban
Copy link
Member

PR Type:

  • ✨ Feature

What is the new behavior? πŸš€

Adds a new JsonToObject in order load a DataContext object from a literal string in XAML resources.

PR Checklist βœ…

Please check if your PR fulfills the following requirements:

Other information ℹ️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new JsonToObject markup extension to the Uno.UI.Toolkit, enabling developers to define structured sample data directly in XAML using JSON strings. The extension parses JSON payloads into dynamic object graphs (ExpandoObject and List<object?>) that can be bound to UI elements, eliminating the need for temporary view model classes during development and testing.

Key changes:

  • New JsonToObjectExtension markup extension that converts JSON strings to dynamic objects
  • Internal JsonToObjectParser utility for JSON-to-object conversion with flexible parsing options
  • XAML builder enhancement to support both JsonToObject and JsonToObjectExtension syntax
  • Comprehensive runtime tests validating JSON parsing, binding, and error scenarios
  • Documentation with usage examples

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Uno.UI/UI/Xaml/Markup/Reader/XamlObjectBuilder.cs Adds fallback logic to resolve properties on markup extension types with "Extension" suffix, enabling standard XAML markup extension naming conventions
src/Uno.UI.Toolkit/Markup/JsonToObjectParser.cs Internal parser that converts JSON documents into dynamic object graphs using ExpandoObject for objects and List for arrays, with support for trailing commas and comments
src/Uno.UI.Toolkit/Markup/JsonToObjectExtension.cs Markup extension implementation with ContentProperty attribute on Json property, providing JSON-to-object conversion with XamlParseException error handling
src/Uno.UI.RuntimeTests/Tests/Uno_UI_Toolkit/Given_JsonToObject.cs Runtime tests covering basic JSON parsing, nested objects, arrays, ItemsControl binding, and error scenarios for invalid/empty JSON
doc/articles/Uno.UI.Toolkit.md User documentation explaining the JsonToObject markup extension with a complete usage example showing JSON resource definition and binding

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21875/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 18, 2025 16:42
@jeromelaban jeromelaban changed the title feat: Add JsonToObject markup extension feat: Add FromJson markup extension Nov 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21875/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21875/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 18, 2025 18:48
@agneszitte
Copy link
Contributor

@mergify backport release/stable/6.4

@mergify
Copy link
Contributor

mergify bot commented Nov 18, 2025

backport release/stable/6.4

βœ… Backports have been created

Details

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

⚠️⚠️ The build 183702 has failed on Uno.UI - CI.

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 19, 2025 01:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 19, 2025 02:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

@jeromelaban jeromelaban force-pushed the dev/jela/jsontoobject branch from 899dbaf to 3315cb0 Compare November 19, 2025 03:33
@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

Copilot AI review requested due to automatic review settings November 19, 2025 04:36
@jeromelaban jeromelaban force-pushed the dev/jela/jsontoobject branch from 3315cb0 to 400572f Compare November 19, 2025 04:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21875/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21875/wasm-skia-net9/index.html

@nventive-devops
Copy link
Contributor

The build 183819 found UI Test snapshots differences: android-28-net9: 17, android-28-net9-Snap: 32, ios: 7, ios-Snap: 53, skia-linux-screenshots: 68, skia-windows-screenshots: 961, wasm: 128, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 13, wasm-automated-net10.0-WinUI-RuntimeTests-0: 0, wasm-automated-net10.0-WinUI-RuntimeTests-1: 0, wasm-automated-net10.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net9: 17 changed over 825

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • WebView_NavigateToAnchor_Initial
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_NoSelection_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • When_Parent_PointerMoved_After_drag_on_non-scrolling_ScrollViewer
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
  • android-28-net9-Snap: 32 changed over 1077

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • TextBlock_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Layout
    • Buttons_UITests_Microsoft_UI_Xaml_Controls_RadioButtonsTests_RadioButtonsPage_UITests_Microsoft_UI_Xaml_Controls_RadioButtonsTests_RadioButtonsPage
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • Pickers_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • Transform_Basics_UITests_Shared_Windows_UI_Xaml_Media_Transform_Basics
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • Scrolling_MUXControlsTestApp_ScrollViewWithScrollControllersPage_MUXControlsTestApp_ScrollViewWithScrollControllersPage
    • WebView_WebView_ChromeClient_Uno_UI_Samples_Content_UITests_WebView_WebView_ChromeClient
    • WebView_WebView_JavascriptInvoke_Uno_UI_Samples_Content_UITests_WebView_WebView_JavascriptInvoke
  • ios: 7 changed over 255

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Check_ListView_Swallows_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • TextBox_UpdatedBinding_On_OneWay_Mode_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Bindings
    • Validate_Offscreen_Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes
  • ios-Snap: 53 changed over 994

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_RectangleStretchFill_Uno_UI_Samples_UITests_ImageBrushTestControl_RectangleStretchFill
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • NavigationView_FluentStyle_NavigationViewSample_SamplesApp_Samples_Microsoft_UI_Xaml_Controls_NavigationViewTests_FluentStyle_FluentStyle_NavigationViewSample
    • Brushes_Uno_UI_Samples_Samples_Shared_Content_UITests_ImageBrushInList_Uno_UI_Samples_Samples_Shared_Content_UITests_ImageBrushInList
    • Grid_CenteredGridinGridwiththreefixedsizechildren_Uno_UI_Samples_Content_UITests_GridTestsControl_CenteredGridinGridwiththreefixedsizechildren
    • NavigationView_MUXControlsTestApp_NavigationViewMenuItemStretchPage_MUXControlsTestApp_NavigationViewMenuItemStretchPage
    • NavigationView_MUXControlsTestApp_NavigationViewMinimalPage_MUXControlsTestApp_NavigationViewMinimalPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS3Page_MUXControlsTestApp_NavigationViewRS3Page
    • Performance_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering
    • ListView_ListView_Aligned_Left_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_Aligned_Left
    • Popup_MessageDialog_UITests_Shared_Windows_UI_Xaml_Controls_Popup_MessageDialog
    • ContentControl_ContentControl_Nested_TemplatedParent_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl
    • NavigationView_MUXControlsTestApp_NavigationViewStretchPage_MUXControlsTestApp_NavigationViewStretchPage
    • Pickers_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • Default_UITests_Windows_UI_Xaml_Controls_Canvas_Grid_ZIndex_UITests_Windows_UI_Xaml_Controls_Canvas_Grid_ZIndex
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromMsAppData
    • ListView_ListView_KeyboardInterception_UITests_Windows_UI_Xaml_Controls_ListView_ListView_KeyboardInterception
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
    • SwipeControl_MUXControlsTestApp_SwipeControlClearPage_MUXControlsTestApp_SwipeControlClearPage
  • skia-linux-screenshots: 68 changed over 2304

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DropDownButtonPage.png-dark
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • Examples.png-dark
    • Examples.png
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ImagesInlineInFlipView.png-dark
    • ImagesInlineInFlipView.png
    • ButtonClippingTestsControl.png
    • DisplayInformation.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
  • skia-windows-screenshots: 961 changed over 2304

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Attributed_text_Simple.png-dark
    • BasicEnability.png-dark
    • BasicEnability.png
    • Buttons.png-dark
    • Buttons.png
    • CenteredGridinGridwithtwofixedsizechildren.png-dark
    • CenteredGridinGridwithtwofixedsizechildren.png
    • CommandBar_BackButtonTitle.png-dark
    • CommandBar_BackButtonTitle.png
    • CommandBar_Background.png-dark
    • CommandBar_Background.png
    • ContentControl_SelectorInheritance.png-dark
    • ContentControl_SelectorInheritance.png
    • ContentControl_SetNull.png-dark
    • ContentControl_SetNull.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • EasClientDeviceInformation.png-dark
    • EasClientDeviceInformation.png
    • GetFocus.png-dark
  • wasm: 128 changed over 1058

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ComboBox.ComboBox_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.InfoBadgeTests.InfoBadgePage
    • UITests.Microsoft_UI_Xaml_Controls.TreeView.TreeViewBasics
    • UITests.Microsoft_UI_Xaml_Controls.TreeViewTests.TreeView_ItemInvoked
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_ViewManagement.TitleBarColorTests
    • UITests.Shared.Windows_UI_Xaml_Controls.Popup.MessageDialog
    • UITests.Shared.Windows_UI_Xaml_Media.Transform.Basics_Automated
    • UITests.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_IsTextSelectionEnabled
    • MUXControlsTestApp.RefreshVisualizerPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_Foreground_While_Collapsed
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.ComboBox.ComboBox_Stretch
    • UITests.Windows_UI_Xaml_Controls.ImageTests.SvgImageSource_MultiLoad
    • UITests.Windows_UI_Xaml_Controls.TimePicker.TimePicker_Header
    • UITests.Windows_UI_Xaml_Controls.TimePicker.TimePicker_TimePickerFlyoutStyle
    • Uno.UI.Samples.Content.UITests.ButtonTestsControl.Buttons
    • Uno.UI.Samples.Content.UITests.ButtonTestsControl.Button_Enabled_Control_Disabled
    • MUXControlsTestApp.CommandBarFlyoutMainPage
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net10.0-WinUI-Default-automated: 13 changed over 877

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_StrokeThickness_MyEllipse
    • Default_StrokeThickness_MyPath
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyLine
    • When_StretchAndAlignmentNone_ImageBrush-50-50-None-XLeft-YBottom
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Default_StrokeThickness_MyPolygon
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyRect
    • When_Theme_Changed_No_Crash_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • wasm-automated-net10.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-2: 0 changed over 1

@jeromelaban jeromelaban merged commit 68dbc8f into master Nov 19, 2025
111 of 112 checks passed
@jeromelaban jeromelaban deleted the dev/jela/jsontoobject branch November 19, 2025 12:16
agneszitte added a commit that referenced this pull request Nov 19, 2025
…6.4/pr-21875

feat: Add FromJson markup extension (backport #21875)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants