Open Closed

extra properties get json value #8925


User avatar
0
ElifKaya created

Hi,

We set the extra properties like:

{"RatingSettings":[{"Name":null,"Type":"N","NumberType":1},{"Name":null,"Type":"N","NumberType":2},{"Name":null,"Type":"N","NumberType":3},{"Name":null,"Type":"N","NumberType":4},{"Name":null,"Type":"N","NumberType":5},{"Name":null,"Type":"N","NumberType":6},{"Name":null,"Type":"N","NumberType":7},{"Name":null,"Type":"N","NumberType":8},{"Name":null,"Type":"N","NumberType":9},{"Name":null,"Type":"N","NumberType":10},{"Name":null,"Type":"N","NumberType":11},{"Name":null,"Type":"N","NumberType":12}]}

Then, I used the Repository's FindAsync method, or another app service method, to get the entity object. The extra properties object is shown like this:

{[RatingSettings, ValueKind = Array : "[{"Name":null,"Type":"N","NumberType":1},{"Name":null,"Type":"N","NumberType":2},{"Name":null,"Type":"N","NumberType":3},{"Name":null,"Type":"N","NumberType":4},{"Name":null,"Type":"N","NumberType":5},{"Name":null,"Type":"N","NumberType":6},{"Name":null,"Type":"N","NumberType":7},{"Name":null,"Type":"N","NumberType":8},{"Name":null,"Type":"N","NumberType":9},{"Name":null,"Type":"N","NumberType":10},{"Name":null,"Type":"N","NumberType":11},{"Name":null,"Type":"N","NumberType":12}]"]}

So, I need to create own parse method. Like this;

I just want to ask that we can use any ABP method without our parse method ? It didn't works GetProperty method.

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v8.2.1
  • UI Type: / MVC /
  • Database System: EF Core (SQL Server,.)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

1 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    ExtraProperties are stored as JSON in the database but whenever you read data, they'll be deserialized into a Dictionary in the C#.

    But it seems you're using multi-level objects since you have only 1 key in your ExtraProperties. Since it's a Dictionary<string, object?> typed property, your value may be a JsonObject or Jobject depending on your configuration and serializer library. https://github.com/abpframework/abp/blob/fc9147ead4e226b1a4d56cd22b4fcd6357ecb15d/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/ExtraPropertiesValueConverter.cs#L61

    If you define specific types to your ExtraProperties or map them into separate columns, you can always use Object Extensions feature to congiure them: https://abp.io/docs/latest/framework/fundamentals/object-extensions

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 16, 2025, 12:13