2017-05-20 8 views
0

전 읽은 모든 항목에서 전역으로 설치된 firebase-tools를 사용하면 내 Windows 명령 프롬프트가 내 프로젝트가 포함 된 폴더에서 열립니다. 작동하는 firebase.json 파일 중포 기지 배포는 내 중포 기지 데이터베이스의 전체 내용을 덮어 다음 명령을 실행 할 수 있어야한다) 잘 작동 :데이터베이스를 사용할 올바른 형식 : firebase-tools를 사용하여 설정

database.json와 그러나
firebase database:set/database.json 

나는 다음과 같은 오류 얻을 :

Error: HTTP Error: 400, Invalid data; couldn't parse JSON object, array, or value. 

데이터베이스를 .json에는 다음이 포함됩니다.

{ 
    "catalogue": { 
    "csi": { 
     "descriptionRoute": "csi", 
     "fileName": "ctk%20Currency%20Strength%20Indicator.algo", 
     "id": 1, 
     "imageUrl": "/images/csi.png", 
     "isFeatured": true, 
     "name": "Currency Strength Indicator", 
     "shortDescription": "Plots the relative strength of 8 major currencies as a line chart", 
     "type": "indicator" 
    }, 
    "csh": { 
     "descriptionRoute": "csh", 
     "fileName": "ctk%20Currency%20Strength%20Heatmap.algo", 
     "id": 2, 
     "imageUrl": "/images/csh.png", 
     "isFeatured": true, 
     "name": "Currency Strength Heatmap", 
     "shortDescription": "Plots the relative strength of 8 major currencies as a heatmap", 
     "type": "indicator" 
    }, 
    "ffc": { 
     "descriptionRoute": "ffc", 
     "fileName": "ctk%20FF%20Calendar.algo", 
     "id": 3, 
     "imageUrl": "/images/ffc.png", 
     "isFeatured": true, 
     "name": "Forex Factory Calendar", 
     "shortDescription": "Lists upcoming events from the Forex Factory RSS feed", 
     "type": "indicator" 
    }, 
    "atrsl": { 
     "descriptionRoute": "atrsl", 
     "fileName": "ctk%20ATR%20Stop%20Loss%20Indicator.algo", 
     "id": 4, 
     "imageUrl": "/images/atrsl.png", 
     "isFeatured": false, 
     "name": "ATR Stop Loss Indicator", 
     "shortDescription": "Displays ATR and stop loss values based on your requirements.", 
     "type": "indicator" 
    }, 
    "ha": { 
     "descriptionRoute": "ha", 
     "fileName": "ctk%20Heken%20Ashi.algo", 
     "id": 5, 
     "imageUrl": "/images/ha.png", 
     "isFeatured": false, 
     "name": "Heiken Ashi", 
     "shortDescription": "Paints Heiken Ashi candles on the host chart.", 
     "type": "indicator" 
    }, 
    "hama": { 
     "descriptionRoute": "hama", 
     "fileName": "ctk%20Heken%20Ashi%20Moving%20Average.algo", 
     "id": 6, 
     "imageUrl": "/images/hama.png", 
     "isFeatured": false, 
     "name": "Heiken Ashi Moving Average", 
     "shortDescription": "Paints Heiken Ashi Moving Average on the host chart.", 
     "type": "indicator" 
    }, 
    "psl": { 
     "descriptionRoute": "psl", 
     "fileName": "ctk%20Psych%20Levels%20.algo", 
     "id": 7, 
     "imageUrl": "/images/psl.png", 
     "isFeatured": false, 
     "name": "Psych Levels", 
     "shortDescription": "Draws lines at psychological levels that often form string Support and Resistance", 
     "type": "indicator" 
    } 
    } 
} 

나는 이걸 보지 못했는데, 내가 봤던 모든 것은 괜찮다고 제안했지만 오류는 내가 얻을 수있는 전부였다.

{ 
    "catalogue": [ 
    null, 
    { 
     "descriptionRoute": "csi", 
     "fileName": "ctk%20Currency%20Strength%20Indicator.algo", 
     "id": 1, 
     "imageUrl": "/images/csi.png", 
     "isFeatured": true, 
     "name": "Currency Strength Indicator", 
     "shortDescription": "Plots the relative strength of 8 major currencies as a line chart", 
     "type": "indicator" 
    }, 
    { 
     "descriptionRoute": "csh", 
     "fileName": "ctk%20Currency%20Strength%20Heatmap.algo", 
     "id": 2, 
     "imageUrl": "/images/csh.png", 
     "isFeatured": true, 
     "name": "Currency Strength Heatmap", 
     "shortDescription": "Plots the relative strength of 8 major currencies as a heatmap", 
     "type": "indicator" 
    }, 
    { 
     "descriptionRoute": "ffc", 
     "fileName": "ctk%20FF%20Calendar.algo", 
     "id": 3, 
     "imageUrl": "/images/ffc.png", 
     "isFeatured": true, 
     "name": "Forex Factory Calendar", 
     "shortDescription": "Lists upcoming events from the Forex Factory RSS feed", 
     "type": "indicator" 
    }, 
    { 
     "descriptionRoute": "atrsl", 
     "fileName": "ctk%20ATR%20Stop%20Loss%20Indicator.algo", 
     "id": 4, 
     "imageUrl": "/images/atrsl.png", 
     "isFeatured": false, 
     "name": "ATR Stop Loss Indicator", 
     "shortDescription": "Displays ATR and stop loss values based on your requirements.", 
     "type": "indicator" 
    } 
    ] 
} 

그런 다음 immdiately

중포 기지 데이터베이스

실행 : 설정/database2.json

을 그리고 같은 오류가 발생했습니다

그래서 나는 다음과 같은 결과

firebase database:get/> database2.json 

를 실행 . 다운로드 한 데이터의 형식을 업로드 할 수없는 경우 어떤 형식으로해야할까요?

+0

별로 도움이되지는 않지만 게시 한 명령을 사용하여 JSON 데이터를 복사하고 성공적으로 업로드 할 수 있다는 점을 알려드립니다. Windows 시스템에서'firebase-tools' 버전 3.9.0 (firebase -V)을 사용했습니다. –

+0

Bob을 이용해 주셔서 감사합니다. 나는 firebase -V를 실행하고 3.9.0은 파일에 대해 이상한 것이어야합니다. – testpossessed

+0

예, 다운로드 된 파일이 실패 했음에도 불구하고 문자 세트 또는 파일의 다른 보이지 않는 속성과 관련이 있다고 생각합니다. 또한. –

답변

1

나는 문제를 해결했고 Bob Snyder는 파일의 인코딩이 문제임을 암시했다.

원래 Visual Studio 2017의 JSON 파일 템플릿에서 파일을 만들었습니다. 인코딩을 확인하기 위해 필자는 NotePad ++에서이 파일을 열었으며 Encoding을 UTF-8-BOM으로 보여주었습니다. 나는 NP ++에서 UTF-8로 인코딩을 변경하고 원래의 명령을 실행 : 그것은 처음 일 내 데이터베이스를 덮어 쓸

firebase database:set/database.json 

합니다.

이 문제를 해결하는 다른 사람은 JSON 파일의 인코딩이 UTF-8인지 확인하십시오.