Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The whole point of this code was to read json files through different directories in which they were inside a folder called parm and populate

The whole point of this code was to read json files through different directories in which they were inside a folder called "parm" and populate them in a csv file. Can you write a code to make it more efficent(shorter lines of code)

below is the java code

import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FilenameFilter; import java.io.PrintWriter; import java.util.Arrays; import com.google.gson.JsonArray; import com.google.gson.JsonParser;

public class start {

public static void main(String[] args) throws FileNotFoundException { // C:\Users\AG05359\Desktop\bdf-rscz-etl\streamsets // System.out.println(Arrays.toString(directories)); String initDirectory = "C:\Users\AG05359\Desktop\bdf-rscz-etl\streamsets"; String [] directories = returnDirectories(initDirectory); System.out.println(Arrays.toString(directories));

//17-19 PrintWriter pw = new PrintWriter(new File("parm.csv")); StringBuilder sb = new StringBuilder(); sb.append("Subject Name"); sb.append(','); sb.append("Template Name"); sb.append(','); sb.append("File Name"); sb.append(','); sb.append("Property Name"); sb.append(','); sb.append("Property Value"); sb.append(' '); for(int i =0;i

}

this should be the output

image text in transcribed

parm.csv-Excel FILE HOME INSERT PAGE LAYOUTFORMULAS DATA REVIEW VIEW Mohamed, Mazen S Cut E Copy Calibri Wrap Text General Fill Clear Paste Conditional Format as Cell Insert Delete Format Sort &Find& B 1 u .2. EE r Merge & Center. $. % , e" Format Painter ormatting TableStyles- Filter Select Font Alignment Cells Editing 4 1 Subject Ni Template File Name Property I Property Value 2 broker ascs 3 broker ascs 4 broker ascs 5 broker ascs 6 broker ascs 7 broker ascs 8 broker ascs 9 broker ascs 10 broker ascs 11 clm 12 clm 13 clm 14clm 15clm 16clm 17 clm 18 clm 19 clm 20clm 21 clm 22clm 23 clm 24 clm BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF BRO BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR BDF CLM BDF SOR 831 831 831 831 831 831 831 831 831 519 100%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions