Generate JSON File from a given YAML file
Simplify File Reading

Java 7 and 8 make I/O a lot simpler. You can simplify your reading of a String from your input file to this:

    private static String readYamlFile(String pathname) throws IOException {
        String lineSeparator = System.getProperty("line.separator");
        List&lt;String&gt; lines = Files.readAllLines(Paths.get(pathname));

        return lines.stream().collect(Collectors.joining(lineSeparator));
    }


Remove the first two Try...Catch block

Your first try...catch blocks catch IOException and then just print out the stack trace. This adds lots of uneccesarry lines for little benefit. If you add throws IOException to public static void main(String args[]) the code becomes clearer, such as:

 public static void main(String[] args) throws IOException {

    //Get File Path
    String sourceFilePath = getSourceFilePath(args);

    //Load File content
    AtomicReference&lt;String&gt; content = new AtomicReference&lt;String&gt;();
    content.set(readYamlFile(sourceFilePath));
    //... and so on


Remove the AtomicReference

The AtomicReference might be useful if the code were multi-threaded. But it's not, the content variable is local to main(). So it just needs to be a String and with the removal of the try..catch above it can be simplified to:

String content = readYamlFile(sourceFilePath);


Don't Use sourceFilePath for your outputFilePath

It's a misleading name, give the output file its own variable. You can also just do it in a single line:

String outputFilePath = sourceFilePath.substring(0, sourceFilePath.length() - 3) + 
"json";


Also - this assumes the extension is three characters, so won't work correctly with a .yaml file. You can use a library like apache-commons to do this in a more foolproof way.

String outputFilePath = FilenameUtils.removeExtension(sourceFilePath)
         + ".json";


Simplify File Writing With PrintWriter

Again later versions of Java make dealing with I/O more straight-forward. I've kept the try...catch block so you can dispay the error message. You can also use the try-with resource to auto-close your PrintWriter if anything goes wrong

    try (PrintWriter out = new PrintWriter(outputFilePath)) {
        out.print(jsonStr);
        System.out.println("Success " + sourceFilePath);
    } catch (IOException err) {
        System.out.println("Error writing to file: " + err );
    }