可以弄清楚如何从JSON提取数据

时间:2018-12-24 17:43:35

标签: python-3.x dictionary

我有一个Google Speech to Text JSON,并且想在彼此之间打印“ confidence,endTime,startTime和word”,或者以4列的表格类型为佳。

经过长时间的尝试,无法解决

private static int t = 0;

private void createAccountBtnActionPerformed(java.awt.event.ActionEvent evt) {                                                 
        progressBar.setValue(0);
        progressBar.setStringPainted(true);

        new Thread(new Runnable() {
            @Override
            public void run() {
                //CreateAccount();

                for (t = 0; t <= 100; t++) {
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            CreateAccount();
                            progressBar.setValue(t);
                        }
                    });
                    try {
                        java.lang.Thread.sleep(100);
                    }
                    catch(InterruptedException e) { }
                }
            }
        }).start();
    }

期望提取原始数据,即

{
  "@type": "type.googleapis.com/google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse",
  "timestamp": "2018-12-25 00:13:42", 
  "results": [
    {
      "alternatives": [
        {
          "confidence": 0.95295364,
          "transcript":  "Bla1 Bla2 Bla3 bla4",
          "words": [
            {
              "confidence": 0.9572171,
              "endTime": "1.600s",
              "startTime": "0s",
              "word":  "Bla"
            },

0 个答案:

没有答案