Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the property if the data is not an array but a json object? #33

Open
RehanProgrammer opened this issue Jul 9, 2018 · 1 comment

Comments

@RehanProgrammer
Copy link

var data = {
extraInfo: {
WhsCode: "880533"

}
}
var map = {
list: extraInfo,
item: {
key: whsCode
}
} //this gives me erro cannot use in operator error. is there a way to use without an array but just json obj

@bozzltron
Copy link
Owner

bozzltron commented Jul 10, 2018

Wrap your target object(s) in an array.

var map ={  
   list: "extraInfo",
   item:{  
      key: "whsCode"
   }
};
var dataTransform = DataTransform({extraInfo:[data.extraInfo]}, map);
var result = dataTransform.transform();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants