@@ -131,7 +131,7 @@ JsonEx._encode = function(value, circular, depth) {
131131 value [ '@' ] = constructorName ;
132132 }
133133 for ( var key in value ) {
134- if ( value . hasOwnProperty ( key ) && ! key . match ( / ^ @ ./ ) ) {
134+ if ( ( ! value . hasOwnProperty || value . hasOwnProperty ( key ) ) && ! key . match ( / ^ @ ./ ) ) {
135135 if ( value [ key ] && typeof value [ key ] === 'object' ) {
136136 if ( value [ key ] [ '@c' ] ) {
137137 circular . push ( [ key , value , value [ key ] ] ) ;
@@ -173,14 +173,16 @@ JsonEx._decode = function(value, circular, registry) {
173173 if ( type === '[object Object]' || type === '[object Array]' ) {
174174 registry [ value [ '@c' ] ] = value ;
175175
176- if ( value [ '@' ] ) {
176+ if ( value [ '@' ] === null ) {
177+ value = this . _resetPrototype ( value , null ) ;
178+ } else if ( value [ '@' ] ) {
177179 var constructor = window [ value [ '@' ] ] ;
178180 if ( constructor ) {
179181 value = this . _resetPrototype ( value , constructor . prototype ) ;
180182 }
181183 }
182184 for ( var key in value ) {
183- if ( value . hasOwnProperty ( key ) ) {
185+ if ( ! value . hasOwnProperty || value . hasOwnProperty ( key ) ) {
184186 if ( value [ key ] && value [ key ] [ '@a' ] ) {
185187 //object is array wrapper
186188 var body = value [ key ] [ '@a' ] ;
@@ -206,6 +208,9 @@ JsonEx._decode = function(value, circular, registry) {
206208 * @private
207209 */
208210JsonEx . _getConstructorName = function ( value ) {
211+ if ( ! value . constructor ) {
212+ return null ;
213+ }
209214 var name = value . constructor . name ;
210215 if ( name === undefined ) {
211216 var func = / ^ \s * f u n c t i o n \s * ( [ A - Z a - z 0 - 9 _ $ ] * ) / ;
0 commit comments