An open API service indexing awesome lists of open source software.

https://github.com/nightmachinery/vcard-to-json

Converts vCard .VCF files into JSON.
https://github.com/nightmachinery/vcard-to-json

Last synced: 3 months ago
JSON representation

Converts vCard .VCF files into JSON.

Awesome Lists containing this project

README

          

#+TITLE: vcard-to-json

=vcard-to-json= converts vCard .VCF files into human-readable JSON. Reversibility of this transformation is not a goal.

This program supports only a limited set of vCard properties. You can open issues to request specific properties added. Please attach an example vCard entity that uses the said properties.

* build
You have to have Clojure installed and =clj= in your path.

#+begin_example zsh
clj -T:build rebuild-uber
#: outputs in ./target/
#+end_example

* usage
#+begin_example zsh
cat my_vcard |
java -jar ./target/vcard-to-json*.jar
#+end_example

Or you can use it without building the uberjar:
#+begin_example zsh
cat my_vcard |
clj -X NightMachinery.vcard-to-json/-main
#+end_example

** examples
#+begin_src bsh.dash :results verbatim :exports both :wrap results
echo "BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//macOS 11.2.1//EN
N:;Peter Black;;;
FN:Peter Black
TEL;type=CELL;type=VOICE;type=pref:+98 413 999 4697
EMAIL;type=INTERNET;type=HOME;type=pref:fake_email@live.com
item1.ADR;type=HOME;type=pref:;;The Dark Street;;;;Neverland
item1.X-ABADR:ir
item2.X-ABRELATEDNAMES;type=pref:Tatsuya Smith
item2.X-ABLabel:_$!!$_
NOTE:some notes here
BDAY:1958-11-14
END:VCARD
" | clj -X NightMachinery.vcard-to-json/-main |
jq . #: to prettify the output
#+end_src

#+begin_example json
[
{
"names-formatted": [
"Peter Black"
],
"names-given": [
"Peter Black"
],
"telephone-numbers": [
{
"types": [
"cell",
"voice",
"pref"
],
"text": "+98 413 999 4697"
}
],
"emails": [
{
"types": [
"internet",
"home",
"pref"
],
"value": "fake_email@live.com"
}
],
"addresses": [
{
"types": [
"home",
"pref"
],
"countries": [
"Neverland"
],
"streetAddresses": [
"The Dark Street"
]
}
],
"birthdays": [
"1958-11-13T20:30:00Z"
],
"notes": [
"some notes here"
]
}
]
#+end_example

* issues

* related
** [[https://github.com/mangstadt/ez-vcard/wiki/jCard][jCard · mangstadt/ez-vcard Wiki · GitHub]]

** [[https://github.com/mangstadt/ez-vcard/issues/78][mangstadt/ez-vcard#78 Write JSON-LD]]

** [[https://github.com/mangstadt/ez-vcard/issues/77][mangstadt/ez-vcard#77 How to convert standard vCard into first-class JSON?]]