How can we improve Breeze.js?

Expose a method on the EntityManager to "unwrap" an entity instance (toJS).

There are a few use cases where an entity instance needs to be sent to the server to an MVC API controller (for example for async server side validation); to do this, it is necessary to obtain an unwrapped version of the instance (plain JSON) that contains no internal properties such as entityAspect and uses properties instead of observables (ko.mapping.toJS is not suitable because of the former). Also, because the client configuration allows for a different naming convention, the method should be able to translate the names back to the naming convention originally used by the server.

Such a method already exists inside the EntityManager, is called "unwrapEntities" although it is private; so the suggestion is only moving it to the public interface of the EntityManager.

More details on this suggestion can be found in

202 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Tona Diaz shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Claus Conrad commented  ·   ·  Flag as inappropriate

    This would be VERY nice. As a workaround I currently requery (.fromEntities) and .select() the desired attributes, but an .unwrap method would be cleaner

  • Heiko commented  ·   ·  Flag as inappropriate

    Just to bring this back to memory. Unwrapped entities is a MUST if handling with all things non-breeze and non-knockout like sending to another webservice or just fill some third-party widget with data.

  • gopheruk commented  ·   ·  Flag as inappropriate

    +1. Currently trying to unwrap some entities to raw JSON in order to do a diff on them via library such as JsonDiffPatch

  • Steve Brown commented  ·   ·  Flag as inappropriate

    This is something we could really use. We want to be able to convert our Breeze client Entities to plain JSON and send them down the wire to other non-Breeze WebAPI service controllers. Problem we have encountered is that when using ko.toJS() it blows up with a circular reference error.

Feedback and Knowledge Base