Importing a JSON with true boolean imports to false - what am I missing?

0
Hi Makers, (Mx 9.22)  I'm doing a rest call, and in the response the boolean isPreferent (almost at the end of the json) is true. Once the mapping is finished (without errors) my NPE however has a false...(which is indeed the default).    The JSON Import lognode on trace says:   Importing JSON using the mapping 'IMP_Product_Single'{"ProductID":"1000165","ProductID2nd":"0692723","ProductID3rd":"0692723","LeadTime":0,"MasterplanningFamily":null,"SearchField":"1000165 COLOMBO OPTIONAL B9358 0692723","OrderQuantityMinimum":null,"OrderQuantityMultiple":null,"ProductName1":"POMP V.ZEEPDISP.V.DIV.SERIES","ProductName2":"COLOMBO OPTIONAL B9358","SafetyStockQuantity":null,"ProductIDShort":0,"TurnoverRate":null,"DateLastUpdated":null,"UnitOfMeasure":{"UnitOfMeasureID":"EA"},"ProductGroup1":{"ProductGroup1ID":"100"},"ProductGroup2":null,"Supplier":null,"GrossCost":null,"GrossSales":null,"GrossPrice":38.75,"changedDate":"2023-04-20T15:56:35.403Z","isPreferent":true,"EAN":"mynewean"}   The import mapping maps the correct attributes, doesn't break but somehow the true is suddenly a false in the newly created object: The NPE after the import action:      The only weird thing I see in the json import / trace  lognode is the for the EAN attribute it first says “Mapping definition found” and then “End element encountered” whereas for the isPreferent there is no logline saying “Mapping Definition found”.   Trace,04/20/2023 18:07:05,JSON Import,"Available mapping elements: (Object) maps to object 'MasterdataIntegration.ProductView' (Object)|ProductID maps to member 'ProductID' ... (Object)|IsPreferent maps to member 'isPreferent' (Object)|EAN maps to member 'EAN' (Object)|DateLastUpdated maps to member 'DateLastUpdated' ... Trace,04/20/2023 18:07:05,JSON Import,"End element encountered for Path(QName(None,changedDate),None,(Object)|changedDate) with content Some(2023-04-20T15:56:35.403Z) (name: QName(None,changedDate))", Trace,04/20/2023 18:07:05,JSON Import,"End element encountered for Path(QName(None,isPreferent),None,(Object)|isPreferent) with content Some(true) (name: QName(None,isPreferent))", Trace,04/20/2023 18:07:05,JSON Import,"Mapping definition found for path 'Path(QName(None,EAN),None,(Object)|EAN)'", Trace,04/20/2023 18:07:05,JSON Import,"End element encountered for Path(QName(None,EAN),None,(Object)|EAN) with content Some(mynewean) (name: QName(None,EAN))",   I wonder if this is my punishment for being lazy and not mapping the boolean to a string in the JSON. That will probably fix the error, but what am I missing here? I Would be so happy with a different perspective on this one...  
asked
1 answers
1

The log mentions isPreferent in the mapping, while the screenshot of the root in your mapping says IsPreferent, with capital I. Could it be that the mapping doesn’t recognize IsPreferent, skips that, and you end up with the default value in your ProductView because the attribute was never mapped?

answered