Add nested records of JSON body into one column while exporting to CSV in powershell

I have JSON including multiple nested records. I want to add records with comma separated and store it in a CSV file. JSON Body { "projectVitals": { "productName": "Enterprise", "name": "WhiteSource Bolt", "token": "61a48eab05356f149828c0e", "creationDate": "2022-10-17 09:08:46", "lastUpdatedDate": "2023-01-25 06:37:32" }, "libraries": [ { "keyUuid": "a89b-40759d783dc3", "keyId": 145110423, "type": "NUGET_PACKAGE_MODULE", "languages": "Nuget", "references": { "url":… Read More Add nested records of JSON body into one column while exporting to CSV in powershell

Trying to access an object from array of objects-Cannot invoke "Student.setName(String)" because "s[i]" is null

I am trying to access an object from an array of objects in a simple program. For hours , I have been scratching my head. The moment I try to call the object from the array of objects using its INDEX VALUE, the output is error. Problem: I am trying to take details from three… Read More Trying to access an object from array of objects-Cannot invoke "Student.setName(String)" because "s[i]" is null

Find overall max element to the left of each element in an arrray (not the first max)

I’m trying to find the max element to the left of each element but i could write code for only the first max. public static void main(String[] args) { int a[]={3,0,0,2,0,4}; Stack<Integer> st=new Stack<Integer>(); ArrayList<Integer> al=new ArrayList<>(); for(int i=0;i<5;i++){ while(st.size()>0 && a[st.peek()]<a[i]){ st.pop(); } if(st.empty()) al.add(a[i]); else al.add(a[st.peek()]); st.push(i); } System.out.println(al); } >Solution : Using… Read More Find overall max element to the left of each element in an arrray (not the first max)

For loop to remove non-strings from a list

I am trying to iterate over the list elemets and remove non-string items. However the loop is failing and removing strings as well. currency.unique() array([‘CADCAD’, ‘CADCHF’, ‘CADEUR’, ‘CADGBp’, ‘CADUSD’, ‘CADNOK’, nan, ‘CADMXN’], dtype=object) Forex_ticker=list(currency.unique()) for item in Forex_ticker: if type(item)!=’str’: print(item,type(item),Forex_ticker) Forex_ticker.remove(item) else: continue CADCAD <class ‘str’> [‘CADCAD’, ‘CADCHF’, ‘CADEUR’, ‘CADGBp’, ‘CADUSD’, ‘CADNOK’, nan, ‘CADMXN’]… Read More For loop to remove non-strings from a list

Trying to get index values of an ArrayList and add them to another ArrayList

Maybe somebody could help me. I don’t understand what is wrong with my code. I want loop through the ArrayList, get the index value of each element (index number itself) and add these index values to another array. Don’t ask me why =)) Here’s my code: List<Integer> a = new ArrayList<>(); a.add(2); a.add(5); a.add(1); List<Integer>… Read More Trying to get index values of an ArrayList and add them to another ArrayList

Javscript/TypeScript: Find the key and append value as an array

I have an object which is like [{ Date: 01/11/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘5’ }, {Title: ‘Comment’, Ans: ‘Awesome’ } ] }, { Date: 01/11/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘2’ }, {Title: ‘Comment’, Ans: ‘Bad’ } ] }, { Date: 09/12/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘3’ }, {Title: ‘Comment’, Ans: ‘Okay’… Read More Javscript/TypeScript: Find the key and append value as an array