0

I have a requirement to serialize json a data by clubbing multiple data. thought of creating a dynamic object. Got a scenario that json name should be a hyphen separated name(for ex : attribute-name) and also need add a property with the name as default.

dynamic jsonDynamic = new System.Dynamic.ExpandoObject();
//**jsonDynamic.default** How to achieve this
//**jsonDynamic.attribute-name** How to achieve this
Prasad
  • 93
  • 8
  • 2
    I doubt that this is possible because "attribute-name" isn't a valid name for a member in c#. Event with dynamic and ExpandoObject involved I tend to believe it still needs to be valid c#. - see here, this just will not compile https://dotnetfiddle.net/zkRTRJ – Rand Random Mar 02 '21 at 13:38
  • Does this answer your question? [JSON.Net, AnonymousTypes and Dashes](https://stackoverflow.com/questions/28787987/json-net-anonymoustypes-and-dashes) – swimex May 19 '21 at 15:07

0 Answers0